Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
7ed9d903
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2300
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7ed9d903
编写于
5月 31, 2019
作者:
T
tensor-tang
提交者:
Yan Chunwei
5月 31, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
enbale lite ci mobile (#17760)
上级
c7621e9e
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
109 addition
and
52 deletion
+109
-52
paddle/fluid/lite/tools/Dockerfile.mobile
paddle/fluid/lite/tools/Dockerfile.mobile
+5
-5
paddle/fluid/lite/tools/build.sh
paddle/fluid/lite/tools/build.sh
+95
-42
paddle/fluid/lite/tools/mobile_readme.md
paddle/fluid/lite/tools/mobile_readme.md
+9
-5
未找到文件。
paddle/fluid/lite/tools/Dockerfile.mobile
浏览文件 @
7ed9d903
...
...
@@ -63,14 +63,14 @@ ENV NDK_ROOT /opt/android-ndk-r17c
RUN cd /opt && unzip /tmp/android-ndk-r17c-linux-x86_64.zip
# for android simulator
ENV ANDROID_HOME /opt/android_sdk
ENV PATH $PATH:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools/bin
RUN wget "https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" && \
unzip sdk-tools-linux-4333796.zip -d /opt/android_sdk && \
mkdir /root/.android && touch /root/.android/repositories.cfg && \
echo y | sdkmanager "platform-tools" "emulator" && \
echo y | sdkmanager "platforms;android-24" && \
echo y | sdkmanager "system-images;android-24;google_apis;arm64-v8a" "system-images;android-24;google_apis;armeabi-v7a"
ENV ANDROID_HOME /opt/android_sdk
ENV PATH $PATH:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools:${ANDROID_HOME}/tools/bin
# this will install the ndk19c and only use clang to compile, then can replace the ndk17c
# echo y | sdkmanager "ndk;19.2.5345600"
...
...
@@ -82,9 +82,9 @@ EXPOSE 5557
EXPOSE 5900
# clean
RUN rm -rf /tmp/android-ndk-r17c-linux-x86_64.zip /cmake-3.10.3-Linux-x86_64.tar.gz
RUN apt-get autoremove -y && apt-get clean
RUN ln -s clang-format-3.8 /usr/bin/clang-format
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple wheel
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pre-commit
RUN apt-get autoremove -y && apt-get clean
RUN rm -rf /sdk-tools-linux-4333796.zip /tmp/android-ndk-r17c-linux-x86_64.zip /cmake-3.10.3-Linux-x86_64.tar.gz
paddle/fluid/lite/tools/build.sh
浏览文件 @
7ed9d903
...
...
@@ -17,45 +17,18 @@ function cmake_gpu {
}
function
cmake_arm
{
# ARM_TARGET_OS="android" , "armlinux"
# ARM_TARGET_ARCH_ABI = "arm64-v8a", "armeabi-v7a" ,"armeabi-v7a-hf"
for
os
in
"android"
"armlinux"
;
do
for
abi
in
"arm64-v8a"
"armeabi-v7a"
"armeabi-v7a-hf"
;
do
if
[[
${
abi
}
==
"armeabi-v7a-hf"
]]
;
then
echo
"armeabi-v7a-hf is not supported on both android and armlinux"
continue
fi
if
[[
${
os
}
==
"armlinux"
&&
${
abi
}
==
"armeabi-v7a"
]]
;
then
echo
"armeabi-v7a is not supported on armlinux yet"
continue
fi
echo
"Build for
${
os
}
${
abi
}
"
build_dir
=
build.lite.
${
os
}
.
${
abi
}
mkdir
-p
$build_dir
cd
$build_dir
# $1: ARM_TARGET_OS in "android" , "armlinux"
# $2: ARM_TARGET_ARCH_ABI in "arm64-v8a", "armeabi-v7a" ,"armeabi-v7a-hf"
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
\
-DWITH_MKL
=
OFF
\
-DARM_TARGET_OS
=
${
os
}
-DARM_TARGET_ARCH_ABI
=
${
abi
}
make test_fc_compute_arm
-j
make test_softmax_compute_arm
-j
make cxx_api_lite_bin
-j
cd
-
done
done
-DARM_TARGET_OS
=
$1
-DARM_TARGET_ARCH_ABI
=
$2
}
function
build
{
...
...
@@ -74,10 +47,37 @@ function test_lite {
done
}
# Run test on mobile
function
test_mobile
{
# TODO(XXX) Implement this
port_armv8
=
5554
port_armv7
=
5556
# Run test on android
function
test_lite_android
{
local
file
=
$1
local
adb_abi
=
$2
local
port
=
if
[[
${
adb_abi
}
==
"armeabi-v7a"
]]
;
then
port
=
${
port_armv7
}
fi
if
[[
${
adb_abi
}
==
"arm64-v8a"
]]
;
then
port
=
${
port_armv8
}
fi
if
[[
"
${
port
}
x"
==
"x"
]]
;
then
echo
"Port can not be empty"
exit
1
fi
echo
"file:
${
file
}
"
# push all to adb and test
adb_work_dir
=
"/data/local/tmp"
skip_list
=
"test_model_parser_lite"
for
_test
in
$(
cat
$file
)
;
do
[[
$skip_list
=
~
(
^|[[:space:]]
)
$_test
(
$|
[[
:space:]]
)
]]
&&
continue
||
echo
'skip $_test'
testpath
=
$(
find ./paddle/fluid
-name
${
_test
}
)
adb
-s
emulator-
${
port
}
push
${
testpath
}
${
adb_work_dir
}
adb
-s
emulator-
${
port
}
shell
chmod
+x
"
${
adb_work_dir
}
/
${
_test
}
"
adb
-s
emulator-
${
port
}
shell
"./
${
adb_work_dir
}
/
${
_test
}
"
done
}
# Build the code and run lite server tests. This is executed in the CI system.
...
...
@@ -90,6 +90,55 @@ function build_test_server {
test_lite
$TESTS_FILE
}
# Build the code and run lite server tests. This is executed in the CI system.
function
build_test_arm
{
adb devices |
grep
emulator |
cut
-f1
|
while
read
line
;
do
adb
-s
$line
emu
kill
;
done
# start android arm64-v8a armeabi-v7a emulators first
echo
n | avdmanager create avd
-f
-n
paddle-armv8
-k
"system-images;android-24;google_apis;arm64-v8a"
echo
-ne
'\n'
|
${
ANDROID_HOME
}
/emulator/emulator
-avd
paddle-armv8
-noaudio
-no-window
-gpu
off
-verbose
-port
${
port_armv8
}
&
sleep
1m
echo
n | avdmanager create avd
-f
-n
paddle-armv7
-k
"system-images;android-24;google_apis;armeabi-v7a"
echo
-ne
'\n'
|
${
ANDROID_HOME
}
/emulator/emulator
-avd
paddle-armv7
-noaudio
-no-window
-gpu
off
-verbose
-port
${
port_armv7
}
&
sleep
1m
for
os
in
"android"
"armlinux"
;
do
for
abi
in
"arm64-v8a"
"armeabi-v7a"
"armeabi-v7a-hf"
;
do
if
[[
${
abi
}
==
"armeabi-v7a-hf"
]]
;
then
echo
"armeabi-v7a-hf is not supported on both android and armlinux"
continue
fi
if
[[
${
os
}
==
"armlinux"
&&
${
abi
}
==
"armeabi-v7a"
]]
;
then
echo
"armeabi-v7a is not supported on armlinux yet"
continue
fi
build_dir
=
build.lite.
${
os
}
.
${
abi
}
mkdir
-p
$build_dir
cd
$build_dir
cmake_arm
${
os
}
${
abi
}
build
$TESTS_FILE
if
[[
${
os
}
==
"android"
]]
;
then
adb_abi
=
${
abi
}
if
[[
${
adb_abi
}
==
"armeabi-v7a-hf"
]]
;
then
adb_abi
=
"armeabi-v7a"
fi
if
[[
${
adb_abi
}
==
"armeabi-v7a"
]]
;
then
# skip v7 tests
continue
fi
test_lite_android
$TESTS_FILE
${
adb_abi
}
# armlinux need in another docker
fi
cd
-
done
done
adb devices |
grep
emulator |
cut
-f1
|
while
read
line
;
do
adb
-s
$line
emu
kill
;
done
echo
"Done"
}
############################# MAIN #################################
function
print_usage
{
echo
-e
"
\n
USAGE:"
...
...
@@ -143,6 +192,10 @@ function main {
build_test_server
shift
;;
build_test_arm
)
build_test_arm
shift
;;
*
)
# unknown option
print_usage
...
...
paddle/fluid/lite/tools/mobile_readme.md
浏览文件 @
7ed9d903
...
...
@@ -55,14 +55,18 @@ make test_fc_compute_arm -j
```
shell
# 创建Android avd (armv8)
$
echo
n | avdmanager create avd
-f
-n
my
armv8
-k
"system-images;android-24;google_apis;arm64-v8a"
$
echo
n | avdmanager create avd
-f
-n
paddle-
armv8
-k
"system-images;android-24;google_apis;arm64-v8a"
# 启动Android armv8 emulator
$
${
ANDROID_HOME
}
/emulator/emulator
-avd
myarmv8
-noaudio
-no-window
-gpu
off
-verbose
&
$
${
ANDROID_HOME
}
/emulator/emulator
-avd
paddle-armv8
-noaudio
-no-window
-gpu
off
-verbose
&
# armv7版本如下:
# $ echo n | avdmanager create avd -f -n myarmv7 -k "system-images;android-24;google_apis;armeabi-v7a"
# $ ${ANDROID_HOME}/emulator/emulator -avd myarmv7 -noaudio -no-window -gpu off -verbose &
# 如果需要执行armv7版本,如下:
# $ echo n | avdmanager create avd -f -n paddle-armv7 -k "system-images;android-24;google_apis;armeabi-v7a"
# $ ${ANDROID_HOME}/emulator/emulator -avd paddle-armv7 -noaudio -no-window -gpu off -verbose &
# 退出所有模拟器
adb devices |
grep
emulator |
cut
-f1
|
while
read
line
;
do
adb
-s
$line
emu
kill
;
done
```
#### 2. 上传编译文件到手机上
键盘上
`crtl+q+p`
同时摁下,切换到容器外(容器还在后台运行),将刚刚编译出的程序
`adb push`
到手机上。USB线连接手机,确保
`adb devices`
可以找到手机设备。
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录