From 31a1f538172f9d887ae2e128ae421d53a2495f29 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Fri, 4 Jun 2021 00:25:53 +0800 Subject: [PATCH] feat(whl/opencl): enable OpenCL in python whl GitOrigin-RevId: a1c34ef40b80b409d387698b52711533cf058f5d --- scripts/whl/macos/macos_build_whl.sh | 3 ++- scripts/whl/manylinux2014/build_wheel_common.sh | 7 ++++--- scripts/whl/manylinux2014/do_build_common.sh | 6 +++--- scripts/whl/windows/windows_build_whl.sh | 3 ++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/whl/macos/macos_build_whl.sh b/scripts/whl/macos/macos_build_whl.sh index 0b02a3f79..9533b7c36 100755 --- a/scripts/whl/macos/macos_build_whl.sh +++ b/scripts/whl/macos/macos_build_whl.sh @@ -101,6 +101,7 @@ BUILD_DIR=${SRC_DIR}/build_dir/host/MGE_WITH_CUDA_OFF/MGE_INFERENCE_ONLY_OFF/Rel INCREMENT_KEY_WORDS="conv_bias.cpp.o is dirty" IS_IN_FIRST_LOOP=TRUE +ORG_EXTRA_CMAKE_FLAG=${EXTRA_CMAKE_FLAG} function do_build() { for ver in ${ALL_PYTHON} do @@ -127,7 +128,7 @@ function do_build() { echo "PYTHON_LIBRARY: ${PYTHON_LIBRARY}" echo "PYTHON_INCLUDE_DIR: ${PYTHON_INCLUDE_DIR}" #config build type to RelWithDebInfo to enable MGB_ENABLE_DEBUG_UTIL etc - export EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo" + export EXTRA_CMAKE_ARGS="${ORG_EXTRA_CMAKE_FLAG} -DCMAKE_BUILD_TYPE=RelWithDebInfo" #append cmake args for config python export EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DPYTHON_EXECUTABLE=${PYTHON_DIR}/bin/python3" export EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DPYTHON_LIBRARY=${PYTHON_LIBRARY}" diff --git a/scripts/whl/manylinux2014/build_wheel_common.sh b/scripts/whl/manylinux2014/build_wheel_common.sh index 0fd55f340..ec3ffffea 100755 --- a/scripts/whl/manylinux2014/build_wheel_common.sh +++ b/scripts/whl/manylinux2014/build_wheel_common.sh @@ -1,5 +1,6 @@ -#!/bin/bash -set -ex +#!/bin/bash -e +set -x + CWD=$(dirname $0) BASEDIR=$(readlink -f ${CWD}/../../..) OUTPUTDIR=$(readlink -f ${CWD}/output) @@ -265,7 +266,7 @@ if [ "$BUILD_GCC8" == "ON" ];then else run_cmd="/home/code/scripts/whl/manylinux2014/do_build_common.sh" fi - +set +x docker run --rm -it $TMPFS_ARGS \ -e UID=${USERID} \ -e PUBLIC_VERSION_POSTFIX=${PUBLIC_VERSION_POSTFIX} \ diff --git a/scripts/whl/manylinux2014/do_build_common.sh b/scripts/whl/manylinux2014/do_build_common.sh index 345b80274..5fc2081dc 100755 --- a/scripts/whl/manylinux2014/do_build_common.sh +++ b/scripts/whl/manylinux2014/do_build_common.sh @@ -1,4 +1,4 @@ -#!/bin/bash -ex +#!/bin/bash -e function handle_strip() { echo "now handle strip $1" @@ -89,6 +89,7 @@ fi INCREMENT_KEY_WORDS=".cu.o is dirty" IS_IN_FIRST_LOOP=TRUE +ORG_EXTRA_CMAKE_FLAG=${EXTRA_CMAKE_FLAG} for ver in ${ALL_PYTHON} do # we want run a full clean build at the first loop @@ -103,8 +104,7 @@ do MAJOR=${python_ver:0:1} MINOR=${ver:1} PYTHON_DIR=/opt/python/cp${python_ver}-cp${ver}/ - export EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} ${EXTRA_CMAKE_FLAG}" - export EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo" + export EXTRA_CMAKE_ARGS="${ORG_EXTRA_CMAKE_FLAG} -DCMAKE_BUILD_TYPE=RelWithDebInfo" export EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DPYTHON_EXECUTABLE=${PYTHON_DIR}/bin/python3" export EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DPYTHON_LIBRARY=${PYTHON_DIR}lib/" export EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DPYTHON_INCLUDE_DIR=${PYTHON_DIR}include/python${MAJOR}.${MINOR}" diff --git a/scripts/whl/windows/windows_build_whl.sh b/scripts/whl/windows/windows_build_whl.sh index 617000302..54a0dfd91 100755 --- a/scripts/whl/windows/windows_build_whl.sh +++ b/scripts/whl/windows/windows_build_whl.sh @@ -114,6 +114,7 @@ BUILD_DIR=${SRC_DIR}/build_dir/host/build/ INCREMENT_KEY_WORDS=".cu.obj is dirty" IS_IN_FIRST_LOOP=TRUE +ORG_EXTRA_CMAKE_FLAG=${EXTRA_CMAKE_FLAG} function do_build() { for ver in ${ALL_PYTHON} do @@ -140,7 +141,7 @@ function do_build() { echo "PYTHON_LIBRARY: ${PYTHON_LIBRARY}" echo "PYTHON_INCLUDE_DIR: ${PYTHON_INCLUDE_DIR}" #config build type to RelWithDebInfo to enable MGB_ENABLE_DEBUG_UTIL etc - export EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo " + export EXTRA_CMAKE_ARGS="${ORG_EXTRA_CMAKE_FLAG} -DCMAKE_BUILD_TYPE=RelWithDebInfo " #call build and install HOST_BUILD_ARGS=" -t -s" -- GitLab