Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
7ed9d903
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
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
...
@@ -63,14 +63,14 @@ ENV NDK_ROOT /opt/android-ndk-r17c
RUN cd /opt && unzip /tmp/android-ndk-r17c-linux-x86_64.zip
RUN cd /opt && unzip /tmp/android-ndk-r17c-linux-x86_64.zip
# for android simulator
# 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" && \
RUN wget "https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip" && \
unzip sdk-tools-linux-4333796.zip -d /opt/android_sdk && \
unzip sdk-tools-linux-4333796.zip -d /opt/android_sdk && \
mkdir /root/.android && touch /root/.android/repositories.cfg && \
mkdir /root/.android && touch /root/.android/repositories.cfg && \
echo y | sdkmanager "platform-tools" "emulator" && \
echo y | sdkmanager "platform-tools" "emulator" && \
echo y | sdkmanager "platforms;android-24" && \
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"
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
# this will install the ndk19c and only use clang to compile, then can replace the ndk17c
# echo y | sdkmanager "ndk;19.2.5345600"
# echo y | sdkmanager "ndk;19.2.5345600"
...
@@ -82,9 +82,9 @@ EXPOSE 5557
...
@@ -82,9 +82,9 @@ EXPOSE 5557
EXPOSE 5900
EXPOSE 5900
# clean
# 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 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 --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 wheel
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pre-commit
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pre-commit
\ No newline at end of file
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 {
...
@@ -17,45 +17,18 @@ function cmake_gpu {
}
}
function
cmake_arm
{
function
cmake_arm
{
# ARM_TARGET_OS="android" , "armlinux"
# $1: ARM_TARGET_OS in "android" , "armlinux"
# ARM_TARGET_ARCH_ABI = "arm64-v8a", "armeabi-v7a" ,"armeabi-v7a-hf"
# $2: ARM_TARGET_ARCH_ABI in "arm64-v8a", "armeabi-v7a" ,"armeabi-v7a-hf"
for
os
in
"android"
"armlinux"
;
do
cmake ..
\
for
abi
in
"arm64-v8a"
"armeabi-v7a"
"armeabi-v7a-hf"
;
do
-DWITH_GPU
=
OFF
\
if
[[
${
abi
}
==
"armeabi-v7a-hf"
]]
;
then
-DWITH_MKL
=
OFF
\
echo
"armeabi-v7a-hf is not supported on both android and armlinux"
-DWITH_LITE
=
ON
\
continue
-DLITE_WITH_CUDA
=
OFF
\
fi
-DLITE_WITH_X86
=
OFF
\
-DLITE_WITH_ARM
=
ON
\
if
[[
${
os
}
==
"armlinux"
&&
${
abi
}
==
"armeabi-v7a"
]]
;
then
-DLITE_WITH_LIGHT_WEIGHT_FRAMEWORK
=
ON
\
echo
"armeabi-v7a is not supported on armlinux yet"
-DWITH_TESTING
=
ON
\
continue
-DARM_TARGET_OS
=
$1
-DARM_TARGET_ARCH_ABI
=
$2
fi
echo
"Build for
${
os
}
${
abi
}
"
build_dir
=
build.lite.
${
os
}
.
${
abi
}
mkdir
-p
$build_dir
cd
$build_dir
cmake ..
\
-DWITH_GPU
=
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
}
}
function
build
{
function
build
{
...
@@ -74,10 +47,37 @@ function test_lite {
...
@@ -74,10 +47,37 @@ function test_lite {
done
done
}
}
# Run test on mobile
port_armv8
=
5554
function
test_mobile
{
port_armv7
=
5556
# TODO(XXX) Implement this
# Run test on android
function
test_lite_android
{
local
file
=
$1
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.
# Build the code and run lite server tests. This is executed in the CI system.
...
@@ -90,6 +90,55 @@ function build_test_server {
...
@@ -90,6 +90,55 @@ function build_test_server {
test_lite
$TESTS_FILE
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 #################################
############################# MAIN #################################
function
print_usage
{
function
print_usage
{
echo
-e
"
\n
USAGE:"
echo
-e
"
\n
USAGE:"
...
@@ -143,6 +192,10 @@ function main {
...
@@ -143,6 +192,10 @@ function main {
build_test_server
build_test_server
shift
shift
;;
;;
build_test_arm
)
build_test_arm
shift
;;
*
)
*
)
# unknown option
# unknown option
print_usage
print_usage
...
...
paddle/fluid/lite/tools/mobile_readme.md
浏览文件 @
7ed9d903
...
@@ -55,14 +55,18 @@ make test_fc_compute_arm -j
...
@@ -55,14 +55,18 @@ make test_fc_compute_arm -j
```
shell
```
shell
# 创建Android avd (armv8)
# 创建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 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版本如下:
# 如果需要执行armv7版本,如下:
# $ echo n | avdmanager create avd -f -n myarmv7 -k "system-images;android-24;google_apis;armeabi-v7a"
# $ echo n | avdmanager create avd -f -n paddle-armv7 -k "system-images;android-24;google_apis;armeabi-v7a"
# $ ${ANDROID_HOME}/emulator/emulator -avd myarmv7 -noaudio -no-window -gpu off -verbose &
# $ ${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. 上传编译文件到手机上
#### 2. 上传编译文件到手机上
键盘上
`crtl+q+p`
同时摁下,切换到容器外(容器还在后台运行),将刚刚编译出的程序
`adb push`
到手机上。USB线连接手机,确保
`adb devices`
可以找到手机设备。
键盘上
`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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录