Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
bea2f2eb
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bea2f2eb
编写于
12月 10, 2019
作者:
H
huzhiqiang
提交者:
GitHub
12月 10, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify ci_build.sh to support ci test with actual mobilephone test=develop (#2525)
上级
dde80670
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
120 addition
and
78 deletion
+120
-78
lite/tools/build.sh
lite/tools/build.sh
+6
-0
lite/tools/ci_build.sh
lite/tools/ci_build.sh
+114
-78
未找到文件。
lite/tools/build.sh
浏览文件 @
bea2f2eb
...
@@ -26,6 +26,12 @@ readonly THIRDPARTY_TAR=https://paddle-inference-dist.bj.bcebos.com/PaddleLite/t
...
@@ -26,6 +26,12 @@ readonly THIRDPARTY_TAR=https://paddle-inference-dist.bj.bcebos.com/PaddleLite/t
readonly
workspace
=
$PWD
readonly
workspace
=
$PWD
# if operating in mac env, we should expand the maximum file num
os_nmae
=
`
uname
-s
`
if
[
${
os_nmae
}
==
"Darwin"
]
;
then
ulimit
-n
1024
fi
# for code gen, a source file is generated after a test, but is dependended by some targets in cmake.
# for code gen, a source file is generated after a test, but is dependended by some targets in cmake.
# here we fake an empty file to make cmake works.
# here we fake an empty file to make cmake works.
function
prepare_workspace
{
function
prepare_workspace
{
...
...
lite/tools/ci_build.sh
浏览文件 @
bea2f2eb
...
@@ -14,6 +14,16 @@ readonly workspace=$PWD
...
@@ -14,6 +14,16 @@ readonly workspace=$PWD
NUM_CORES_FOR_COMPILE
=
${
LITE_BUILD_THREADS
:-
8
}
NUM_CORES_FOR_COMPILE
=
${
LITE_BUILD_THREADS
:-
8
}
# global variables
#whether to use emulator as adb devices,when USE_ADB_EMULATOR=ON we use emulator, else we will use connected mobile phone as adb devices.
USE_ADB_EMULATOR
=
ON
# if operating in mac env, we should expand the maximum file num
os_nmae
=
`
uname
-s
`
if
[
${
os_nmae
}
==
"Darwin"
]
;
then
ulimit
-n
1024
fi
function
prepare_thirdparty
{
function
prepare_thirdparty
{
if
[
!
-d
$workspace
/third-party
-o
-f
$workspace
/third-party-05b862.tar.gz
]
;
then
if
[
!
-d
$workspace
/third-party
-o
-f
$workspace
/third-party-05b862.tar.gz
]
;
then
rm
-rf
$workspace
/third-party
rm
-rf
$workspace
/third-party
...
@@ -27,6 +37,27 @@ function prepare_thirdparty {
...
@@ -27,6 +37,27 @@ function prepare_thirdparty {
fi
fi
}
}
# prepare adb devices
# if USE_ADB_EMULATOR=ON , we create adb emulator port_armv8 and port_armv7 for usage, else we will use actual mobilephone according to adbindex.
function
prepare_adb_devices
{
port_armv8
=
5554
port_armv7
=
5556
if
[
$USE_ADB_EMULATOR
==
"ON"
]
;
then
prepare_emulator
$port_armv8
$port_armv7
device_armv8
=
emulator-
$port_armv8
device_armv7
=
emulator-
$port_armv7
else
adb_devices
=(
$(
adb devices |grep
-v
devices |grep device |
awk
-F
" "
'{print $1}'
)
)
# adbindex is the env variable registered in ci agent to tell which mobile is to used as adb
if
[
${
adbindex
}
>
${#
adb_devices
[@]
}
-1
]
;
then
echo
-e
"Error: the adb devices on ci agent are not enough, at least
${
adbindex
}
adb devices are needed."
exit
1
fi
echo
${
adb_devices
[
${
adbindex
}
]
}
device_armv8
=
${
adb_devices
[
${
adbindex
}
]
}
device_armv7
=
${
adb_devices
[
${
adbindex
}
]
}
fi
}
# for code gen, a source file is generated after a test, but is dependended by some targets in cmake.
# for code gen, a source file is generated after a test, but is dependended by some targets in cmake.
# here we fake an empty file to make cmake works.
# here we fake an empty file to make cmake works.
...
@@ -77,7 +108,7 @@ function cmake_opencl {
...
@@ -77,7 +108,7 @@ function cmake_opencl {
}
}
function
run_gen_code_test
{
function
run_gen_code_test
{
local
port
=
$1
local
device
=
$1
local
gen_code_file_name
=
"__generated_code__.cc"
local
gen_code_file_name
=
"__generated_code__.cc"
local
gen_code_file_path
=
"./lite/gen_code/
${
gen_code_file_path
}
"
local
gen_code_file_path
=
"./lite/gen_code/
${
gen_code_file_path
}
"
local
adb_work_dir
=
"/data/local/tmp"
local
adb_work_dir
=
"/data/local/tmp"
...
@@ -87,20 +118,20 @@ function run_gen_code_test {
...
@@ -87,20 +118,20 @@ function run_gen_code_test {
# 2. run test_cxx_api_lite in emulator to get opt model
# 2. run test_cxx_api_lite in emulator to get opt model
local
test_cxx_api_lite_path
=
$(
find ./lite
-name
test_cxx_api
)
local
test_cxx_api_lite_path
=
$(
find ./lite
-name
test_cxx_api
)
adb
-s
emulator-
${
port
}
push
"./third_party/install/lite_naive_model"
${
adb_work_dir
}
adb
-s
${
device
}
push
"./third_party/install/lite_naive_model"
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
push
${
test_cxx_api_lite_path
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
test_cxx_api_lite_path
}
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
shell
"
${
adb_work_dir
}
/test_cxx_api --model_dir=
${
adb_work_dir
}
/lite_naive_model --optimized_model=
${
adb_work_dir
}
/lite_naive_model_opt"
adb
-s
${
device
}
shell
"
${
adb_work_dir
}
/test_cxx_api --model_dir=
${
adb_work_dir
}
/lite_naive_model --optimized_model=
${
adb_work_dir
}
/lite_naive_model_opt"
# 3. build test_gen_code
# 3. build test_gen_code
make test_gen_code
-j
$NUM_CORES_FOR_COMPILE
make test_gen_code
-j
$NUM_CORES_FOR_COMPILE
# 4. run test_gen_code_lite in emulator to get __generated_code__.cc
# 4. run test_gen_code_lite in emulator to get __generated_code__.cc
local
test_gen_code_lite_path
=
$(
find ./lite
-name
test_gen_code
)
local
test_gen_code_lite_path
=
$(
find ./lite
-name
test_gen_code
)
adb
-s
emulator-
${
port
}
push
${
test_gen_code_lite_path
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
test_gen_code_lite_path
}
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
shell
"
${
adb_work_dir
}
/test_gen_code --optimized_model=
${
adb_work_dir
}
/lite_naive_model_opt --generated_code_file=
${
adb_work_dir
}
/
${
gen_code_file_name
}
"
adb
-s
${
device
}
shell
"
${
adb_work_dir
}
/test_gen_code --optimized_model=
${
adb_work_dir
}
/lite_naive_model_opt --generated_code_file=
${
adb_work_dir
}
/
${
gen_code_file_name
}
"
# 5. pull __generated_code__.cc down and mv to build real path
# 5. pull __generated_code__.cc down and mv to build real path
adb
-s
emulator-
${
port
}
pull
"
${
adb_work_dir
}
/
${
gen_code_file_name
}
"
.
adb
-s
${
device
}
pull
"
${
adb_work_dir
}
/
${
gen_code_file_name
}
"
.
mv
${
gen_code_file_name
}
${
gen_code_file_path
}
mv
${
gen_code_file_name
}
${
gen_code_file_path
}
# 6. build test_generated_code
# 6. build test_generated_code
...
@@ -324,12 +355,12 @@ function build_test_xpu {
...
@@ -324,12 +355,12 @@ function build_test_xpu {
# test_arm_android <some_test_name> <adb_port_number>
# test_arm_android <some_test_name> <adb_port_number>
function
test_arm_android
{
function
test_arm_android
{
local
test_name
=
$1
local
test_name
=
$1
local
port
=
$2
local
device
=
$2
if
[[
"
${
test_name
}
x"
==
"x"
]]
;
then
if
[[
"
${
test_name
}
x"
==
"x"
]]
;
then
echo
"test_name can not be empty"
echo
"test_name can not be empty"
exit
1
exit
1
fi
fi
if
[[
"
${
port
}
x"
==
"x"
]]
;
then
if
[[
"
${
device
}
x"
==
"x"
]]
;
then
echo
"Port can not be empty"
echo
"Port can not be empty"
exit
1
exit
1
fi
fi
...
@@ -344,20 +375,20 @@ function test_arm_android {
...
@@ -344,20 +375,20 @@ function test_arm_android {
local
testpath
=
$(
find ./lite
-name
${
test_name
}
)
local
testpath
=
$(
find ./lite
-name
${
test_name
}
)
adb
-s
emulator-
${
port
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
shell
"cd
${
adb_work_dir
}
&& ./
${
test_name
}
"
adb
-s
${
device
}
shell
"cd
${
adb_work_dir
}
&& ./
${
test_name
}
"
adb
-s
emulator-
${
port
}
shell
"rm
${
adb_work_dir
}
/
${
test_name
}
"
adb
-s
${
device
}
shell
"rm
${
adb_work_dir
}
/
${
test_name
}
"
}
}
# test_npu <some_test_name> <adb_port_number>
# test_npu <some_test_name> <adb_port_number>
function
test_npu
{
function
test_npu
{
local
test_name
=
$1
local
test_name
=
$1
local
port
=
$2
local
device
=
$2
if
[[
"
${
test_name
}
x"
==
"x"
]]
;
then
if
[[
"
${
test_name
}
x"
==
"x"
]]
;
then
echo
"test_name can not be empty"
echo
"test_name can not be empty"
exit
1
exit
1
fi
fi
if
[[
"
${
port
}
x"
==
"x"
]]
;
then
if
[[
"
${
device
}
x"
==
"x"
]]
;
then
echo
"Port can not be empty"
echo
"Port can not be empty"
exit
1
exit
1
fi
fi
...
@@ -373,33 +404,33 @@ function test_npu {
...
@@ -373,33 +404,33 @@ function test_npu {
local
testpath
=
$(
find ./lite
-name
${
test_name
}
)
local
testpath
=
$(
find ./lite
-name
${
test_name
}
)
# note the ai_ddk_lib is under paddle-lite root directory
# note the ai_ddk_lib is under paddle-lite root directory
adb
-s
emulator-
${
port
}
push ../ai_ddk_lib/lib64/
*
${
adb_work_dir
}
adb
-s
${
device
}
push ../ai_ddk_lib/lib64/
*
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
testpath
}
${
adb_work_dir
}
if
[[
${
test_name
}
==
"test_npu_pass"
]]
;
then
if
[[
${
test_name
}
==
"test_npu_pass"
]]
;
then
local
model_name
=
mobilenet_v1
local
model_name
=
mobilenet_v1
adb
-s
emulator-
${
port
}
push
"./third_party/install/
${
model_name
}
"
${
adb_work_dir
}
adb
-s
${
device
}
push
"./third_party/install/
${
model_name
}
"
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
shell
"rm -rf
${
adb_work_dir
}
/
${
model_name
}
_opt "
adb
-s
${
device
}
shell
"rm -rf
${
adb_work_dir
}
/
${
model_name
}
_opt "
adb
-s
emulator-
${
port
}
shell
"cd
${
adb_work_dir
}
; export LD_LIBRARY_PATH=./ ; export GLOG_v=0; ./
${
test_name
}
--model_dir=./
${
model_name
}
--optimized_model=./
${
model_name
}
_opt"
adb
-s
${
device
}
shell
"cd
${
adb_work_dir
}
; export LD_LIBRARY_PATH=./ ; export GLOG_v=0; ./
${
test_name
}
--model_dir=./
${
model_name
}
--optimized_model=./
${
model_name
}
_opt"
elif
[[
${
test_name
}
==
"test_subgraph_pass"
]]
;
then
elif
[[
${
test_name
}
==
"test_subgraph_pass"
]]
;
then
local
model_name
=
mobilenet_v1
local
model_name
=
mobilenet_v1
adb
-s
emulator-
${
port
}
push
"./third_party/install/
${
model_name
}
"
${
adb_work_dir
}
adb
-s
${
device
}
push
"./third_party/install/
${
model_name
}
"
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
shell
"cd
${
adb_work_dir
}
; export LD_LIBRARY_PATH=./ ; export GLOG_v=0; ./
${
test_name
}
--model_dir=./
${
model_name
}
"
adb
-s
${
device
}
shell
"cd
${
adb_work_dir
}
; export LD_LIBRARY_PATH=./ ; export GLOG_v=0; ./
${
test_name
}
--model_dir=./
${
model_name
}
"
else
else
adb
-s
emulator-
${
port
}
shell
"cd
${
adb_work_dir
}
; export LD_LIBRARY_PATH=./ ; ./
${
test_name
}
"
adb
-s
${
device
}
shell
"cd
${
adb_work_dir
}
; export LD_LIBRARY_PATH=./ ; ./
${
test_name
}
"
fi
fi
}
}
function
test_npu_model
{
function
test_npu_model
{
local
test_name
=
$1
local
test_name
=
$1
local
port
=
$2
local
device
=
$2
local
model_dir
=
$3
local
model_dir
=
$3
if
[[
"
${
test_name
}
x"
==
"x"
]]
;
then
if
[[
"
${
test_name
}
x"
==
"x"
]]
;
then
echo
"test_name can not be empty"
echo
"test_name can not be empty"
exit
1
exit
1
fi
fi
if
[[
"
${
port
}
x"
==
"x"
]]
;
then
if
[[
"
${
device
}
x"
==
"x"
]]
;
then
echo
"Port can not be empty"
echo
"Port can not be empty"
exit
1
exit
1
fi
fi
...
@@ -412,17 +443,17 @@ function test_npu_model {
...
@@ -412,17 +443,17 @@ function test_npu_model {
adb_work_dir
=
"/data/local/tmp"
adb_work_dir
=
"/data/local/tmp"
testpath
=
$(
find ./lite
-name
${
test_name
}
)
testpath
=
$(
find ./lite
-name
${
test_name
}
)
adb
-s
emulator-
${
port
}
push ../ai_ddk_lib/lib64/
*
${
adb_work_dir
}
adb
-s
${
device
}
push ../ai_ddk_lib/lib64/
*
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
push
${
model_dir
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
model_dir
}
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
shell
chmod
+x
"
${
adb_work_dir
}
/
${
test_name
}
"
adb
-s
${
device
}
shell
chmod
+x
"
${
adb_work_dir
}
/
${
test_name
}
"
local
adb_model_path
=
"
${
adb_work_dir
}
/
`
basename
${
model_dir
}
`
"
local
adb_model_path
=
"
${
adb_work_dir
}
/
`
basename
${
model_dir
}
`
"
adb
-s
emulator-
${
port
}
shell
"export LD_LIBRARY_PATH=
${
adb_work_dir
}
;
${
adb_work_dir
}
/
${
test_name
}
--model_dir=
$adb_model_path
"
adb
-s
${
device
}
shell
"export LD_LIBRARY_PATH=
${
adb_work_dir
}
;
${
adb_work_dir
}
/
${
test_name
}
--model_dir=
$adb_model_path
"
}
}
# test the inference high level api
# test the inference high level api
function
test_arm_api
{
function
test_arm_api
{
local
port
=
$1
local
device
=
$1
local
test_name
=
"test_paddle_api"
local
test_name
=
"test_paddle_api"
make
$test_name
-j
$NUM_CORES_FOR_COMPILE
make
$test_name
-j
$NUM_CORES_FOR_COMPILE
...
@@ -431,23 +462,23 @@ function test_arm_api {
...
@@ -431,23 +462,23 @@ function test_arm_api {
local
remote_model
=
${
adb_work_dir
}
/paddle_api
local
remote_model
=
${
adb_work_dir
}
/paddle_api
local
testpath
=
$(
find ./lite
-name
${
test_name
}
)
local
testpath
=
$(
find ./lite
-name
${
test_name
}
)
arm_push_necessary_file
$
port
$model_path
$remote_model
arm_push_necessary_file
$
device
$model_path
$remote_model
adb
-s
emulator-
${
port
}
shell
mkdir
-p
$remote_model
adb
-s
${
device
}
shell
mkdir
-p
$remote_model
adb
-s
emulator-
${
port
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
shell
chmod
+x
"
${
adb_work_dir
}
/
${
test_name
}
"
adb
-s
${
device
}
shell
chmod
+x
"
${
adb_work_dir
}
/
${
test_name
}
"
adb
-s
emulator-
${
port
}
shell
"
${
adb_work_dir
}
/
${
test_name
}
--model_dir
$remote_model
"
adb
-s
${
device
}
shell
"
${
adb_work_dir
}
/
${
test_name
}
--model_dir
$remote_model
"
}
}
function
test_arm_model
{
function
test_arm_model
{
local
test_name
=
$1
local
test_name
=
$1
local
port
=
$2
local
device
=
$2
local
model_dir
=
$3
local
model_dir
=
$3
if
[[
"
${
test_name
}
x"
==
"x"
]]
;
then
if
[[
"
${
test_name
}
x"
==
"x"
]]
;
then
echo
"test_name can not be empty"
echo
"test_name can not be empty"
exit
1
exit
1
fi
fi
if
[[
"
${
port
}
x"
==
"x"
]]
;
then
if
[[
"
${
device
}
x"
==
"x"
]]
;
then
echo
"Port can not be empty"
echo
"Port can not be empty"
exit
1
exit
1
fi
fi
...
@@ -460,11 +491,11 @@ function test_arm_model {
...
@@ -460,11 +491,11 @@ function test_arm_model {
adb_work_dir
=
"/data/local/tmp"
adb_work_dir
=
"/data/local/tmp"
testpath
=
$(
find ./lite
-name
${
test_name
}
)
testpath
=
$(
find ./lite
-name
${
test_name
}
)
adb
-s
emulator-
${
port
}
push
${
model_dir
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
model_dir
}
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
shell
chmod
+x
"
${
adb_work_dir
}
/
${
test_name
}
"
adb
-s
${
device
}
shell
chmod
+x
"
${
adb_work_dir
}
/
${
test_name
}
"
local
adb_model_path
=
"
${
adb_work_dir
}
/
`
basename
${
model_dir
}
`
"
local
adb_model_path
=
"
${
adb_work_dir
}
/
`
basename
${
model_dir
}
`
"
adb
-s
emulator-
${
port
}
shell
"
${
adb_work_dir
}
/
${
test_name
}
--model_dir=
$adb_model_path
"
adb
-s
${
device
}
shell
"
${
adb_work_dir
}
/
${
test_name
}
--model_dir=
$adb_model_path
"
}
}
# function _test_model_optimize_tool {
# function _test_model_optimize_tool {
...
@@ -491,11 +522,11 @@ function test_model_optimize_tool_compile {
...
@@ -491,11 +522,11 @@ function test_model_optimize_tool_compile {
}
}
function
_test_paddle_code_generator
{
function
_test_paddle_code_generator
{
local
port
=
$1
local
device
=
$1
local
test_name
=
paddle_code_generator
local
test_name
=
paddle_code_generator
local
remote_test
=
$ADB_WORK_DIR
/
$test_name
local
remote_test
=
$ADB_WORK_DIR
/
$test_name
local
remote_model
=
$ADB_WORK_DIR
/lite_naive_model.opt
local
remote_model
=
$ADB_WORK_DIR
/lite_naive_model.opt
local
adb
=
"adb -s
emulator-
${
port
}
"
local
adb
=
"adb -s
${
device
}
"
make paddle_code_generator
-j
$NUM_CORES_FOR_COMPILE
make paddle_code_generator
-j
$NUM_CORES_FOR_COMPILE
local
test_path
=
$(
find
.
-name
$test_name
|
head
-n1
)
local
test_path
=
$(
find
.
-name
$test_name
|
head
-n1
)
...
@@ -576,8 +607,6 @@ function build_arm {
...
@@ -576,8 +607,6 @@ function build_arm {
cmake_arm
${
os
}
${
abi
}
${
lang
}
cmake_arm
${
os
}
${
abi
}
${
lang
}
build
$TESTS_FILE
build
$TESTS_FILE
# test publish inference lib
make publish_inference
}
}
# $1: ARM_TARGET_OS in "android"
# $1: ARM_TARGET_OS in "android"
...
@@ -614,7 +643,7 @@ function test_arm {
...
@@ -614,7 +643,7 @@ function test_arm {
os
=
$1
os
=
$1
abi
=
$2
abi
=
$2
lang
=
$3
lang
=
$3
port
=
$4
device
=
$4
if
[[
${
os
}
==
"armlinux"
]]
;
then
if
[[
${
os
}
==
"armlinux"
]]
;
then
# TODO(hongming): enable test armlinux on armv8, armv7 and armv7hf
# TODO(hongming): enable test armlinux on armv8, armv7 and armv7hf
...
@@ -628,16 +657,16 @@ function test_arm {
...
@@ -628,16 +657,16 @@ function test_arm {
fi
fi
# prepare for CXXApi test
# prepare for CXXApi test
local
adb
=
"adb -s
emulator-
${
port
}
"
local
adb
=
"adb -s
${
device
}
"
$adb
shell
mkdir
-p
/data/local/tmp/lite_naive_model_opt
$adb
shell
mkdir
-p
/data/local/tmp/lite_naive_model_opt
echo
"test file:
${
TESTS_FILE
}
"
echo
"test file:
${
TESTS_FILE
}
"
for
_test
in
$(
cat
$TESTS_FILE
)
;
do
for
_test
in
$(
cat
$TESTS_FILE
)
;
do
test_arm_android
$_test
$
port
test_arm_android
$_test
$
device
done
done
# test finally
# test finally
test_arm_api
$
port
test_arm_api
$
device
# _test_model_optimize_tool $port
# _test_model_optimize_tool $port
# _test_paddle_code_generator $port
# _test_paddle_code_generator $port
...
@@ -661,11 +690,11 @@ function prepare_emulator {
...
@@ -661,11 +690,11 @@ function prepare_emulator {
}
}
function
arm_push_necessary_file
{
function
arm_push_necessary_file
{
local
port
=
$1
local
device
=
$1
local
testpath
=
$2
local
testpath
=
$2
local
adb_work_dir
=
$3
local
adb_work_dir
=
$3
adb
-s
emulator-
${
port
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
${
device
}
push
${
testpath
}
${
adb_work_dir
}
}
}
function
build_test_arm_opencl
{
function
build_test_arm_opencl
{
...
@@ -688,15 +717,13 @@ function build_test_arm_opencl {
...
@@ -688,15 +717,13 @@ function build_test_arm_opencl {
function
build_test_arm_subtask_android
{
function
build_test_arm_subtask_android
{
########################################################################
########################################################################
# job 1-4 must be in one runner
# job 1-4 must be in one runner
port_armv8
=
5554
prepare_adb_devices
port_armv7
=
5556
prepare_emulator
$port_armv8
$port_armv7
# job 1
# job 1
build_arm
"android"
"armv8"
"gcc"
build_arm
"android"
"armv8"
"gcc"
run_gen_code_test
${
port_armv8
}
adb
-s
$device_armv8
shell
'rm -rf /data/local/tmp/*'
test_arm
"android"
"armv8"
"gcc"
${
port_armv8
}
run_gen_code_test
${
device_armv8
}
test_arm
"android"
"armv8"
"gcc"
${
device_armv8
}
cd
-
cd
-
# job 2
# job 2
...
@@ -707,8 +734,9 @@ function build_test_arm_subtask_android {
...
@@ -707,8 +734,9 @@ function build_test_arm_subtask_android {
# job 3
# job 3
build_arm
"android"
"armv7"
"gcc"
build_arm
"android"
"armv7"
"gcc"
run_gen_code_test
${
port_armv7
}
adb
-s
$device_armv7
shell
'rm -rf /data/local/tmp/*'
test_arm
"android"
"armv7"
"gcc"
${
port_armv7
}
run_gen_code_test
${
device_armv7
}
test_arm
"android"
"armv7"
"gcc"
${
device_armv7
}
cd
-
cd
-
# job 4
# job 4
...
@@ -717,7 +745,9 @@ function build_test_arm_subtask_android {
...
@@ -717,7 +745,9 @@ function build_test_arm_subtask_android {
#test_arm "android" "armv7" "clang" ${port_armv7}
#test_arm "android" "armv7" "clang" ${port_armv7}
#cd -
#cd -
if
[
$USE_ADB_EMULATOR
==
"ON"
]
;
then
adb devices |
grep
emulator |
cut
-f1
|
while
read
line
;
do
adb
-s
$line
emu
kill
;
done
adb devices |
grep
emulator |
cut
-f1
|
while
read
line
;
do
adb
-s
$line
emu
kill
;
done
fi
echo
"Done"
echo
"Done"
}
}
...
@@ -726,17 +756,17 @@ function build_test_arm_subtask_armlinux {
...
@@ -726,17 +756,17 @@ function build_test_arm_subtask_armlinux {
cur
=
$PWD
cur
=
$PWD
# job 5
# job 5
build_arm
"armlinux"
"armv8"
"gcc"
build_arm
"armlinux"
"armv8"
"gcc"
test_arm
"armlinux"
"armv8"
"gcc"
$
port
_armv8
test_arm
"armlinux"
"armv8"
"gcc"
$
device
_armv8
cd
$cur
cd
$cur
# job 6
# job 6
build_arm
"armlinux"
"armv7"
"gcc"
build_arm
"armlinux"
"armv7"
"gcc"
test_arm
"armlinux"
"armv7"
"gcc"
$
port
_armv8
test_arm
"armlinux"
"armv7"
"gcc"
$
device
_armv8
cd
$cur
cd
$cur
# job 7
# job 7
build_arm
"armlinux"
"armv7hf"
"gcc"
build_arm
"armlinux"
"armv7hf"
"gcc"
test_arm
"armlinux"
"armv7hf"
"gcc"
$
port
_armv8
test_arm
"armlinux"
"armv7hf"
"gcc"
$
device
_armv8
cd
$cur
cd
$cur
echo
"Done"
echo
"Done"
...
@@ -744,8 +774,6 @@ function build_test_arm_subtask_armlinux {
...
@@ -744,8 +774,6 @@ function build_test_arm_subtask_armlinux {
# sub-task-model
# sub-task-model
function
build_test_arm_subtask_model
{
function
build_test_arm_subtask_model
{
local
port_armv8
=
5554
local
port_armv7
=
5556
# We just test following single one environment to limit the CI time.
# We just test following single one environment to limit the CI time.
local
os
=
android
local
os
=
android
local
abi
=
armv8
local
abi
=
armv8
...
@@ -761,12 +789,16 @@ function build_test_arm_subtask_model {
...
@@ -761,12 +789,16 @@ function build_test_arm_subtask_model {
cmake_arm
$os
$abi
$lang
cmake_arm
$os
$abi
$lang
make
$test_name
-j
$NUM_CORES_FOR_COMPILE
make
$test_name
-j
$NUM_CORES_FOR_COMPILE
prepare_emulator
$port_armv8
$port_armv7
# prepare adb devices
prepare_adb_devices
adb
-s
$device_armv8
shell
'rm -rf /data/local/tmp/*'
# just test the model on armv8
# just test the model on armv8
test_arm_model
$test_name
$
port
_armv8
"./third_party/install/
$model_name
"
test_arm_model
$test_name
$
device
_armv8
"./third_party/install/
$model_name
"
if
[
$USE_ADB_EMULATOR
==
"ON"
]
;
then
adb devices |
grep
emulator |
cut
-f1
|
while
read
line
;
do
adb
-s
$line
emu
kill
;
done
adb devices |
grep
emulator |
cut
-f1
|
while
read
line
;
do
adb
-s
$line
emu
kill
;
done
fi
echo
"Done"
echo
"Done"
cd
-
cd
-
rm
-rf
$build_dir
rm
-rf
$build_dir
...
@@ -775,16 +807,16 @@ function build_test_arm_subtask_model {
...
@@ -775,16 +807,16 @@ function build_test_arm_subtask_model {
# this test load a model, optimize it and check the prediction result of both cxx and light APIS.
# this test load a model, optimize it and check the prediction result of both cxx and light APIS.
function
test_arm_predict_apis
{
function
test_arm_predict_apis
{
local
port
=
$1
local
device
=
$1
local
workspace
=
$2
local
workspace
=
$2
local
naive_model_path
=
$3
local
naive_model_path
=
$3
local
api_test_path
=
$(
find
.
-name
"test_apis"
)
local
api_test_path
=
$(
find
.
-name
"test_apis"
)
# the model is pushed to ./lite_naive_model
# the model is pushed to ./lite_naive_model
adb
-s
emulator-
${
port
}
push
${
naive_model_path
}
${
workspace
}
adb
-s
${
device
}
push
${
naive_model_path
}
${
workspace
}
adb
-s
emulator-
${
port
}
push
$api_test_path
${
workspace
}
adb
-s
${
device
}
push
$api_test_path
${
workspace
}
# test cxx_api first to store the optimized model.
# test cxx_api first to store the optimized model.
adb
-s
emulator-
${
port
}
shell ./test_apis
--model_dir
./lite_naive_model
--optimized_model
./lite_naive_model_opt
adb
-s
${
device
}
shell ./test_apis
--model_dir
./lite_naive_model
--optimized_model
./lite_naive_model_opt
}
}
...
@@ -792,9 +824,6 @@ function test_arm_predict_apis {
...
@@ -792,9 +824,6 @@ function test_arm_predict_apis {
function
build_test_arm
{
function
build_test_arm
{
########################################################################
########################################################################
# job 1-4 must be in one runner
# job 1-4 must be in one runner
port_armv8
=
5554
port_armv7
=
5556
build_test_arm_subtask_android
build_test_arm_subtask_android
build_test_arm_subtask_armlinux
build_test_arm_subtask_armlinux
}
}
...
@@ -816,16 +845,19 @@ function build_test_npu {
...
@@ -816,16 +845,19 @@ function build_test_npu {
# just test the model on armv8
# just test the model on armv8
# prepare_emulator $port_armv8
# prepare_emulator $port_armv8
prepare_emulator
$port_armv8
$port_armv7
local
device_armv8
=
emulator-
$port_armv8
if
[[
"
${
test_name
}
x"
!=
"x"
]]
;
then
if
[[
"
${
test_name
}
x"
!=
"x"
]]
;
then
test_npu
${
test_name
}
${
port
_armv8
}
test_npu
${
test_name
}
${
device
_armv8
}
else
else
# run_gen_code_test ${port_armv8}
# run_gen_code_test ${port_armv8}
for
_test
in
$(
cat
$TESTS_FILE
|
grep
npu
)
;
do
for
_test
in
$(
cat
$TESTS_FILE
|
grep
npu
)
;
do
test_npu
$_test
$
port
_armv8
test_npu
$_test
$
device
_armv8
done
done
fi
fi
test_npu_model
$test_model_name
$
port
_armv8
"./third_party/install/
$model_name
"
test_npu_model
$test_model_name
$
device
_armv8
"./third_party/install/
$model_name
"
cd
-
cd
-
# just test the model on armv8
# just test the model on armv8
# adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done
# adb devices | grep emulator | cut -f1 | while read line; do adb -s $line emu kill; done
...
@@ -910,6 +942,10 @@ function main {
...
@@ -910,6 +942,10 @@ function main {
ARM_PORT
=
"
${
i
#*=
}
"
ARM_PORT
=
"
${
i
#*=
}
"
shift
shift
;;
;;
--use_adb_emulator
=
*
)
USE_ADB_EMULATOR
=
"
${
i
#*=
}
"
shift
;;
build
)
build
)
build
$TESTS_FILE
build
$TESTS_FILE
build
$LIBS_FILE
build
$LIBS_FILE
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录