提交 d0386c7b 编写于 作者: Z Zhen Wang

Use separated CI functions for OpenCL. test=develop

上级 2eadbf9a
...@@ -95,8 +95,8 @@ build:mobile_android_cl: ...@@ -95,8 +95,8 @@ build:mobile_android_cl:
cache: cache:
key: mobile_thirdparty key: mobile_thirdparty
paths: paths:
- build.lite.android.armv8.gcc.cl_enable/third_party - build.lite.android.armv8.gcc.opencl/third_party
- build.lite.android.armv7.gcc.cl_enable/third_party - build.lite.android.armv7.gcc.opencl/third_party
- ~/.ccache - ~/.ccache
- $CI_PROJECT_DIR/build_mobile_ccache_cl - $CI_PROJECT_DIR/build_mobile_ccache_cl
script: script:
......
...@@ -33,6 +33,65 @@ function cmake_x86 { ...@@ -33,6 +33,65 @@ function cmake_x86 {
cmake .. -DWITH_GPU=OFF -DWITH_MKLDNN=OFF -DLITE_WITH_X86=ON ${common_flags} cmake .. -DWITH_GPU=OFF -DWITH_MKLDNN=OFF -DLITE_WITH_X86=ON ${common_flags}
} }
function cmake_opencl {
prepare_workspace
# $1: ARM_TARGET_OS in "android" , "armlinux"
# $2: ARM_TARGET_ARCH_ABI in "armv8", "armv7" ,"armv7hf"
# $3: ARM_TARGET_LANG in "gcc" "clang"
cmake .. \
-DLITE_WITH_OPENCL=ON \
-DWITH_GPU=OFF \
-DWITH_MKL=OFF \
-DWITH_LITE=ON \
-DLITE_WITH_CUDA=OFF \
-DLITE_WITH_X86=OFF \
-DLITE_WITH_ARM=ON \
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \
-DWITH_TESTING=ON \
-DARM_TARGET_OS=$1 -DARM_TARGET_ARCH_ABI=$2 -DARM_TARGET_LANG=$3
}
# $1: ARM_TARGET_OS in "android" , "armlinux"
# $2: ARM_TARGET_ARCH_ABI in "armv8", "armv7" ,"armv7hf"
# $3: ARM_TARGET_LANG in "gcc" "clang"
function build_opencl {
os=$1
abi=$2
lang=$3
cur_dir=$(pwd)
if [[ ${os} == "armlinux" ]]; then
# TODO(hongming): enable compile armv7 and armv7hf on armlinux, and clang compile
if [[ ${lang} == "clang" ]]; then
echo "clang is not enabled on armlinux yet"
return 0
fi
if [[ ${abi} == "armv7hf" ]]; then
echo "armv7hf is not supported on armlinux yet"
return 0
fi
if [[ ${abi} == "armv7" ]]; then
echo "armv7 is not supported on armlinux yet"
return 0
fi
fi
if [[ ${os} == "android" && ${abi} == "armv7hf" ]]; then
echo "android do not need armv7hf"
return 0
fi
build_dir=$cur_dir/build.lite.${os}.${abi}.${lang}.opencl
mkdir -p $build_dir
cd $build_dir
cmake_opencl ${os} ${abi} ${lang}
build $TESTS_FILE
# test publish inference lib
make publish_inference_lite
}
# This method is only called in CI. # This method is only called in CI.
function cmake_x86_for_CI { function cmake_x86_for_CI {
prepare_workspace # fake an empty __generated_code__.cc to pass cmake. prepare_workspace # fake an empty __generated_code__.cc to pass cmake.
...@@ -204,48 +263,25 @@ function cmake_arm { ...@@ -204,48 +263,25 @@ function cmake_arm {
# $1: ARM_TARGET_OS in "android" , "armlinux" # $1: ARM_TARGET_OS in "android" , "armlinux"
# $2: ARM_TARGET_ARCH_ABI in "armv8", "armv7" ,"armv7hf" # $2: ARM_TARGET_ARCH_ABI in "armv8", "armv7" ,"armv7hf"
# $3: ARM_TARGET_LANG in "gcc" "clang" # $3: ARM_TARGET_LANG in "gcc" "clang"
# $4: LITE_WITH_OPENCL in ON OFF cmake .. \
os=$1 -DWITH_GPU=OFF \
abi=$2 -DWITH_MKL=OFF \
lang=$3 -DWITH_LITE=ON \
opencl=$4 -DLITE_WITH_CUDA=OFF \
-DLITE_WITH_X86=OFF \
if [[ ${opencl} == "cl_enable" ]]; then -DLITE_WITH_ARM=ON \
echo "-- Enable OpenCL --" -DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \
cmake .. \ -DWITH_TESTING=ON \
-DLITE_WITH_OPENCL=ON \ -DARM_TARGET_OS=$1 -DARM_TARGET_ARCH_ABI=$2 -DARM_TARGET_LANG=$3
-DWITH_GPU=OFF \
-DWITH_MKL=OFF \
-DWITH_LITE=ON \
-DLITE_WITH_CUDA=OFF \
-DLITE_WITH_X86=OFF \
-DLITE_WITH_ARM=ON \
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \
-DWITH_TESTING=ON \
-DARM_TARGET_OS=${os} -DARM_TARGET_ARCH_ABI=${abi} -DARM_TARGET_LANG=${lang}
else
cmake .. \
-DWITH_GPU=OFF \
-DWITH_MKL=OFF \
-DWITH_LITE=ON \
-DLITE_WITH_CUDA=OFF \
-DLITE_WITH_X86=OFF \
-DLITE_WITH_ARM=ON \
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON \
-DWITH_TESTING=ON \
-DARM_TARGET_OS=${os} -DARM_TARGET_ARCH_ABI=${abi} -DARM_TARGET_LANG=${lang}
fi
} }
# $1: ARM_TARGET_OS in "android" , "armlinux" # $1: ARM_TARGET_OS in "android" , "armlinux"
# $2: ARM_TARGET_ARCH_ABI in "armv8", "armv7" ,"armv7hf" # $2: ARM_TARGET_ARCH_ABI in "armv8", "armv7" ,"armv7hf"
# $3: ARM_TARGET_LANG in "gcc" "clang" # $3: ARM_TARGET_LANG in "gcc" "clang"
# $4: LITE_WITH_OPENCL in ON OFF
function build_arm { function build_arm {
os=$1 os=$1
abi=$2 abi=$2
lang=$3 lang=$3
opencl=$4
cur_dir=$(pwd) cur_dir=$(pwd)
if [[ ${os} == "armlinux" ]]; then if [[ ${os} == "armlinux" ]]; then
...@@ -269,11 +305,11 @@ function build_arm { ...@@ -269,11 +305,11 @@ function build_arm {
return 0 return 0
fi fi
build_dir=$cur_dir/build.lite.${os}.${abi}.${lang}.${opencl} build_dir=$cur_dir/build.lite.${os}.${abi}.${lang}
mkdir -p $build_dir mkdir -p $build_dir
cd $build_dir cd $build_dir
cmake_arm ${os} ${abi} ${lang} ${opencl} cmake_arm ${os} ${abi} ${lang}
build $TESTS_FILE build $TESTS_FILE
# test publish inference lib # test publish inference lib
...@@ -339,15 +375,14 @@ function arm_push_necessary_file { ...@@ -339,15 +375,14 @@ function arm_push_necessary_file {
function build_test_arm_opencl { function build_test_arm_opencl {
######################################################################## ########################################################################
# job 1-4 must be in one runner
cur=$PWD cur=$PWD
# job 5 # job 1
build_arm "android" "armv8" "gcc" "cl_enable" build_opencl "android" "armv8" "gcc"
cd $cur cd $cur
# job 6 # job 2
build_arm "android" "armv7" "gcc" "cl_enable" build_opencl "android" "armv7" "gcc"
cd $cur cd $cur
echo "Done" echo "Done"
...@@ -519,11 +554,6 @@ function main { ...@@ -519,11 +554,6 @@ function main {
ARM_PORT="${i#*=}" ARM_PORT="${i#*=}"
shift shift
;; ;;
--opencl=*)
OPENCL="${i#*=}"
shift
;;
build) build)
build $TESTS_FILE build $TESTS_FILE
build $LIBS_FILE build $LIBS_FILE
...@@ -537,16 +567,24 @@ function main { ...@@ -537,16 +567,24 @@ function main {
cmake_x86 cmake_x86
shift shift
;; ;;
cmake_opencl)
cmake_opencl $ARM_OS $ARM_ABI $ARM_LANG
shift
;;
cmake_cuda) cmake_cuda)
cmake_cuda cmake_cuda
shift shift
;; ;;
cmake_arm) cmake_arm)
cmake_arm $ARM_OS $ARM_ABI $ARM_LANG $OPENCL cmake_arm $ARM_OS $ARM_ABI $ARM_LANG
shift
;;
build_opencl)
build_opencl $ARM_OS $ARM_ABI $ARM_LANG
shift shift
;; ;;
build_arm) build_arm)
build_arm $ARM_OS $ARM_ABI $ARM_LANG $OPENCL build_arm $ARM_OS $ARM_ABI $ARM_LANG
shift shift
;; ;;
test_server) test_server)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册