Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
16c33ef4
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
16c33ef4
编写于
6月 17, 2019
作者:
T
tensor-tang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tangjian/lite/cmake
上级
c62ae03b
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
143 addition
and
93 deletion
+143
-93
CMakeLists.txt
CMakeLists.txt
+18
-7
cmake/cross_compiling/android.cmake
cmake/cross_compiling/android.cmake
+11
-12
cmake/cross_compiling/armlinux.cmake
cmake/cross_compiling/armlinux.cmake
+12
-5
paddle/fluid/lite/api/cxx_api_bin.cc
paddle/fluid/lite/api/cxx_api_bin.cc
+3
-3
paddle/fluid/lite/core/context.cc
paddle/fluid/lite/core/context.cc
+22
-17
paddle/fluid/lite/kernels/arm/conv_compute.cc
paddle/fluid/lite/kernels/arm/conv_compute.cc
+2
-0
paddle/fluid/lite/kernels/arm/fc_compute.cc
paddle/fluid/lite/kernels/arm/fc_compute.cc
+3
-0
paddle/fluid/lite/kernels/arm/mul_compute.cc
paddle/fluid/lite/kernels/arm/mul_compute.cc
+2
-1
paddle/fluid/lite/kernels/arm/pool_compute.cc
paddle/fluid/lite/kernels/arm/pool_compute.cc
+5
-0
paddle/fluid/lite/kernels/arm/pool_compute.h
paddle/fluid/lite/kernels/arm/pool_compute.h
+1
-0
paddle/fluid/lite/tools/build.sh
paddle/fluid/lite/tools/build.sh
+55
-46
paddle/fluid/lite/tools/mobile_readme.md
paddle/fluid/lite/tools/mobile_readme.md
+9
-2
未找到文件。
CMakeLists.txt
浏览文件 @
16c33ef4
...
...
@@ -22,6 +22,7 @@ include(system)
if
(
LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
)
cmake_minimum_required
(
VERSION 3.10
)
# TODO(TJ): make as function check_default
# check os
if
(
NOT DEFINED ARM_TARGET_OS
)
set
(
ARM_TARGET_OS
"android"
CACHE STRING
"Choose ARM Target OS"
)
endif
()
...
...
@@ -31,19 +32,17 @@ if(LITE_WITH_LIGHT_WEIGHT_FRAMEWORK)
message
(
FATAL_ERROR
"ARM_TARGET_OS must be in one of
${
ARM_TARGET_OS_LIST
}
"
)
endif
()
# check arch abi
if
(
NOT DEFINED ARM_TARGET_ARCH_ABI
)
set
(
ARM_TARGET_ARCH_ABI
"arm
64-v8a
"
CACHE STRING
"Choose ARM Target ARCH ABI"
)
set
(
ARM_TARGET_ARCH_ABI
"arm
v8
"
CACHE STRING
"Choose ARM Target ARCH ABI"
)
endif
()
set
(
ARM_TARGET_ARCH_ABI_LIST
"arm
64-v8a"
"armeabi-v7a"
"armeabi-v7a-softfp"
"armeabi-v7a-hf
"
)
set
(
ARM_TARGET_ARCH_ABI_LIST
"arm
v8"
"armv7"
"armv7hf"
"arm64-v8a"
"armeabi-v7a
"
)
set_property
(
CACHE ARM_TARGET_ARCH_ABI PROPERTY STRINGS
${
ARM_TARGET_ARCH_ABI_LIST
}
)
if
(
NOT ARM_TARGET_ARCH_ABI IN_LIST ARM_TARGET_ARCH_ABI_LIST
)
message
(
FATAL_ERROR
"ARM_TARGET_ARCH_ABI must be in one of
${
ARM_TARGET_ARCH_ABI_LIST
}
"
)
endif
()
if
(
NOT DEFINED TARGET_ARCH_ABI
)
set
(
ARCH_ABI
"arm64-v8a"
CACHE STRING
"Choose android platform"
)
endif
()
message
(
STATUS
"Lite ARM Compile
${
ARM_TARGET_OS
}
with
${
ARM_TARGET_ARCH_ABI
}
"
)
include
(
cross_compiling/host
)
include
(
cross_compiling/armlinux
)
include
(
cross_compiling/android
)
...
...
@@ -171,8 +170,20 @@ if (WITH_LITE AND LITE_WITH_LIGHT_WEIGHT_FRAMEWORK)
include
(
generic
)
# simplify cmake module
include
(
configure
)
# add paddle env configuration
add_definitions
(
-std=c++11
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++11"
)
find_package
(
OpenMP REQUIRED
)
if
(
OPENMP_FOUND OR OpenMP_CXX_FOUND
)
add_definitions
(
-DARM_WITH_OMP
)
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
${
OpenMP_C_FLAGS
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
${
OpenMP_CXX_FLAGS
}
"
)
message
(
STATUS
"Found OpenMP
${
OpenMP_VERSION
}
${
OpenMP_CXX_VERSION
}
"
)
message
(
STATUS
" |-- OpenMP C flags:
${
OpenMP_C_FLAGS
}
"
)
message
(
STATUS
" |-- OpenMP CXX flags:
${
OpenMP_CXX_FLAGS
}
"
)
message
(
STATUS
" |-- OpenMP OpenMP_CXX_LIB_NAMES:
${
OpenMP_CXX_LIB_NAMES
}
"
)
message
(
STATUS
" `-- OpenMP OpenMP_CXX_LIBRARIES:
${
OpenMP_CXX_LIBRARIES
}
"
)
else
()
message
(
FATAL_ERROR
"Could not found openmp !"
)
endif
()
add_subdirectory
(
paddle
)
return
()
...
...
cmake/cross_compiling/android.cmake
浏览文件 @
16c33ef4
...
...
@@ -26,7 +26,6 @@ if(NOT DEFINED ANDROID_NDK)
endif
()
endif
()
if
(
NOT DEFINED ANDROID_API_LEVEL
)
set
(
ANDROID_API_LEVEL
"22"
)
endif
()
...
...
@@ -35,19 +34,26 @@ if(NOT DEFINED ANDROID_STL_TYPE)
set
(
ANDROID_STL_TYPE
"c++_static"
CACHE STRING
"stl type"
)
endif
()
# TODO(TJ): enable me
if
(
ARM_TARGET_ARCH_ABI STREQUAL
"armeabi-v7a-hf"
)
message
(
FATAL_ERROR
"Not supported building android armeabi-v7a-hf yet"
)
if
(
ARM_TARGET_ARCH_ABI STREQUAL
"armv7hf"
)
message
(
FATAL_ERROR
"ANDROID does not support hardfp on v7 use armv7 instead."
)
endif
()
set
(
ANDROID_ARCH_ABI
${
ARM_TARGET_ARCH_ABI
}
CACHE STRING
"Choose Android Arch ABI"
)
if
(
ARM_TARGET_ARCH_ABI STREQUAL
"armv8"
)
set
(
ANDROID_ARCH_ABI
"arm64-v8a"
)
endif
()
if
(
ARM_TARGET_ARCH_ABI STREQUAL
"armv7"
)
set
(
ANDROID_ARCH_ABI
"armeabi-v7a"
)
endif
()
if
(
ANDROID_ARCH_ABI STREQUAL
"armeabi-v7a-softfp"
)
set
(
ANDROID_ARCH_ABI
"armeabi-v7a"
)
endif
()
set
(
ANDROID_ARCH_ABI_LIST
"arm64-v8a"
"armeabi-v7a"
"armeabi-v6"
"armeabi"
"mips"
"mips64"
"x86"
"x86_64"
"armeabi-v7a-hf"
)
"mips"
"mips64"
"x86"
"x86_64"
)
set_property
(
CACHE ANDROID_ARCH_ABI PROPERTY STRINGS
${
ANDROID_ARCH_ABI_LIST
}
)
if
(
NOT ANDROID_ARCH_ABI IN_LIST ANDROID_ARCH_ABI_LIST
)
message
(
FATAL_ERROR
"ANDROID_ARCH_ABI must be in one of
${
ANDROID_ARCH_ABI_LIST
}
"
)
...
...
@@ -59,13 +65,6 @@ if(ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
message
(
STATUS
"NEON is enabled on arm-v7a with softfp"
)
endif
()
if
(
ANDROID_ARCH_ABI STREQUAL
"armeabi-v7a-hf"
)
set
(
ANDROID_ARCH_ABI
"armeabi-v7a"
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv4
${
CMAKE_CXX_FLAGS
}
"
)
set
(
CMAKE_C_FLAGS
"-march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv4
${
CMAKE_C_FLAGS
}
"
)
message
(
STATUS
"NEON is enabled on arm-v7a with hard float"
)
endif
()
set
(
ANDROID_STL_TYPE_LITS
"gnustl_static"
"c++_static"
)
set_property
(
CACHE ANDROID_STL_TYPE PROPERTY STRINGS
${
ANDROID_STL_TYPE_LITS
}
)
if
(
NOT ANDROID_STL_TYPE IN_LIST ANDROID_STL_TYPE_LITS
)
...
...
cmake/cross_compiling/armlinux.cmake
浏览文件 @
16c33ef4
...
...
@@ -20,7 +20,15 @@ set(ARMLINUX TRUE)
add_definitions
(
-DLITE_WITH_LINUX
)
set
(
CMAKE_SYSTEM_NAME Linux
)
if
(
ARM_TARGET_ARCH_ABI STREQUAL
"arm64-v8a"
)
set
(
ARMLINUX_ARCH_ABI
${
ARM_TARGET_ARCH_ABI
}
CACHE STRING
"Choose Android Arch ABI"
)
set
(
ARMLINUX_ARCH_ABI_LIST
"armv8"
"armv7"
"armv7hf"
)
set_property
(
CACHE ARMLINUX_ARCH_ABI PROPERTY STRINGS
${
ARMLINUX_ARCH_ABI_LIST
}
)
if
(
NOT ARMLINUX_ARCH_ABI IN_LIST ARMLINUX_ARCH_ABI_LIST
)
message
(
FATAL_ERROR
"ARMLINUX_ARCH_ABI(
${
ARMLINUX_ARCH_ABI
}
) must be in one of
${
ARMLINUX_ARCH_ABI_LIST
}
"
)
endif
()
if
(
ARMLINUX_ARCH_ABI STREQUAL
"armv8"
)
set
(
CMAKE_SYSTEM_PROCESSOR aarch64
)
set
(
CMAKE_C_COMPILER
"aarch64-linux-gnu-gcc"
)
set
(
CMAKE_CXX_COMPILER
"aarch64-linux-gnu-g++"
)
...
...
@@ -30,13 +38,12 @@ if(ARM_TARGET_ARCH_ABI STREQUAL "arm64-v8a")
message
(
STATUS
"NEON is enabled on arm64-v8a"
)
endif
()
if
(
ARM_TARGET_ARCH_ABI STREQUAL
"armeabi-v7a"
OR ARM_TARGET_ARCH_ABI STREQUAL
"armeabi-v7a-hf"
)
if
(
ARMLINUX_ARCH_ABI STREQUAL
"armv7"
OR ARMLINUX_ARCH_ABI STREQUAL
"armv7hf"
)
message
(
FATAL_ERROR
"Not supported building arm linux arm-v7 yet"
)
endif
()
# TODO(TJ): make sure v7 works
if
(
ARM
_TARGET_ARCH_ABI STREQUAL
"armeabi-v7a
"
)
if
(
ARM
LINUX_ARCH_ABI STREQUAL
"armv7
"
)
set
(
CMAKE_SYSTEM_PROCESSOR arm
)
set
(
CMAKE_C_COMPILER
"arm-linux-gnueabi-gcc"
)
set
(
CMAKE_CXX_COMPILER
"arm-linux-gnueabi-g++"
)
...
...
@@ -46,7 +53,7 @@ if(ARM_TARGET_ARCH_ABI STREQUAL "armeabi-v7a")
message
(
STATUS
"NEON is enabled on arm-v7a with softfp"
)
endif
()
if
(
ARM
_TARGET_ARCH_ABI STREQUAL
"armeabi-v7a-
hf"
)
if
(
ARM
LINUX_ARCH_ABI STREQUAL
"armv7
hf"
)
set
(
CMAKE_SYSTEM_PROCESSOR arm
)
set
(
CMAKE_C_COMPILER
"arm-linux-gnueabihf-gcc"
)
set
(
CMAKE_CXX_COMPILER
"arm-linux-gnueabihf-g++"
)
...
...
paddle/fluid/lite/api/cxx_api_bin.cc
浏览文件 @
16c33ef4
...
...
@@ -13,7 +13,7 @@
// limitations under the License.
#include "paddle/fluid/lite/api/cxx_api.h"
#include <chrono>
#include <chrono>
// NOLINT
#include "paddle/fluid/lite/core/mir/passes.h"
#include "paddle/fluid/lite/core/op_registry.h"
namespace
paddle
{
...
...
@@ -66,8 +66,8 @@ void Run(const char* model_dir, int repeat) {
}
// namespace paddle
int
main
(
int
argc
,
char
**
argv
)
{
CHECK_EQ
(
argc
,
2
)
<<
"usage: ./cmd <model_dir
>"
;
paddle
::
lite
::
Run
(
argv
[
1
],
1
);
CHECK_EQ
(
argc
,
3
)
<<
"usage: ./cmd <model_dir> <repeat
>"
;
paddle
::
lite
::
Run
(
argv
[
1
],
std
::
stoi
(
argv
[
2
])
);
return
0
;
}
...
...
paddle/fluid/lite/core/context.cc
浏览文件 @
16c33ef4
...
...
@@ -28,6 +28,10 @@
#endif // TARGET_OS_IPHONE
#endif // __APPLE__
#ifdef ARM_WITH_OMP
#include <omp.h>
#endif
namespace
paddle
{
namespace
lite
{
...
...
@@ -84,7 +88,7 @@ ARMContext& Context<TargetType::kARM>::operator=(const ARMContext& ctx) {
}
void
Context
<
TargetType
::
kARM
>::
BindDev
()
{
#ifdef
USE_OPEN
MP
#ifdef
ARM_WITH_O
MP
int
num_threads
=
active_ids_
.
size
();
omp_set_num_threads
(
num_threads
);
#ifdef LITE_WITH_LINUX
...
...
@@ -98,12 +102,12 @@ void Context<TargetType::kARM>::BindDev() {
}
for
(
int
i
=
0
;
i
<
num_threads
;
i
++
)
{
if
(
ssarets
[
i
]
!=
0
)
{
LOG
E
(
"set cpu affinity failed, cpuID: %d
\n
"
,
active_ids_
[
i
])
;
LOG
(
ERROR
)
<<
"set cpu affinity failed, cpuID: "
<<
active_ids_
[
i
]
;
return
;
}
}
#endif // LITE_WITH_LINUX
#else //
USE_OPEN
MP
#else //
ARM_WITH_O
MP
#ifdef LITE_WITH_LINUX
std
::
vector
<
int
>
cpuid1
;
cpuid1
.
push_back
(
active_ids_
[
0
]);
...
...
@@ -113,7 +117,7 @@ void Context<TargetType::kARM>::BindDev() {
return
;
}
#endif // LITE_WITH_LINUX
#endif //
USE_OPEN
MP
#endif //
ARM_WITH_O
MP
}
void
Context
<
TargetType
::
kARM
>::
SetRunMode
(
PowerMode
mode
,
int
threads
)
{
...
...
@@ -123,7 +127,7 @@ void Context<TargetType::kARM>::SetRunMode(PowerMode mode, int threads) {
if
(
threads
>
big_core_size
+
small_core_size
)
{
threads
=
big_core_size
+
small_core_size
;
}
#ifdef
USE_OPEN
MP
#ifdef
ARM_WITH_O
MP
count_
++
;
int
shift_num
=
(
count_
/
10
)
%
big_core_size
;
switch
(
mode
)
{
...
...
@@ -146,8 +150,8 @@ void Context<TargetType::kARM>::SetRunMode(PowerMode mode, int threads) {
if
(
big_core_size
>
0
)
{
mode_
=
LITE_POWER_HIGH
;
if
(
threads
>
big_core_size
)
{
LOG
E
(
"threads: %d, exceed the big cores size: %d
\n
"
,
threads
,
big_core_size
)
;
LOG
(
ERROR
)
<<
"threads: "
<<
threads
<<
", exceed the big cores size: "
<<
big_core_size
;
active_ids_
=
dev
.
big_core_ids_
;
}
else
{
for
(
int
i
=
0
;
i
<
threads
;
++
i
)
{
...
...
@@ -156,7 +160,7 @@ void Context<TargetType::kARM>::SetRunMode(PowerMode mode, int threads) {
}
}
else
{
mode_
=
LITE_POWER_LOW
;
LOG
E
(
"HIGH POWER MODE is not support, switch to little cores
\n
"
)
;
LOG
(
ERROR
)
<<
"HIGH POWER MODE is not support, switch to little cores"
;
if
(
threads
>
small_core_size
)
{
active_ids_
=
dev
.
little_core_ids_
;
}
else
{
...
...
@@ -174,8 +178,8 @@ void Context<TargetType::kARM>::SetRunMode(PowerMode mode, int threads) {
if
(
small_core_size
>
0
)
{
mode_
=
LITE_POWER_LOW
;
if
(
threads
>
small_core_size
)
{
LOG
W
(
"threads: %d, exceed the little cores size: %d
\n
"
,
threads
,
small_core_size
)
;
LOG
(
WARNING
)
<<
"threads: "
<<
threads
<<
", exceed the little cores size: "
<<
small_core_size
;
active_ids_
=
dev
.
little_core_ids_
;
}
else
{
for
(
int
i
=
0
;
i
<
threads
;
++
i
)
{
...
...
@@ -184,7 +188,7 @@ void Context<TargetType::kARM>::SetRunMode(PowerMode mode, int threads) {
}
}
else
{
mode_
=
LITE_POWER_HIGH
;
LOG
W
(
"LOW POWER MODE is not support, switch to big cores
\n
"
)
;
LOG
(
WARNING
)
<<
"LOW POWER MODE is not support, switch to big cores"
;
if
(
threads
>
big_core_size
)
{
active_ids_
=
dev
.
big_core_ids_
;
}
else
{
...
...
@@ -211,8 +215,8 @@ void Context<TargetType::kARM>::SetRunMode(PowerMode mode, int threads) {
if
(
big_core_size
>
0
)
{
mode_
=
LITE_POWER_RAND_HIGH
;
if
(
threads
>
big_core_size
)
{
LOG
W
(
"threads: %d, exceed the big cores size: %d
\n
"
,
threads
,
big_core_size
)
;
LOG
(
WARNING
)
<<
"threads: "
<<
threads
<<
", exceed the big cores size: "
<<
big_core_size
;
active_ids_
=
dev
.
big_core_ids_
;
}
else
{
for
(
int
i
=
0
;
i
<
threads
;
++
i
)
{
...
...
@@ -222,7 +226,8 @@ void Context<TargetType::kARM>::SetRunMode(PowerMode mode, int threads) {
}
}
else
{
mode_
=
LITE_POWER_LOW
;
LOGW
(
"HIGH POWER MODE is not support, switch to little cores
\n
"
);
LOG
(
WARNING
)
<<
"HIGH POWER MODE is not support, switch to little cores"
;
if
(
threads
>
small_core_size
)
{
active_ids_
=
dev
.
little_core_ids_
;
}
else
{
...
...
@@ -240,8 +245,8 @@ void Context<TargetType::kARM>::SetRunMode(PowerMode mode, int threads) {
if
(
small_core_size
>
0
)
{
mode_
=
LITE_POWER_RAND_LOW
;
if
(
threads
>
small_core_size
)
{
LOG
W
(
"threads: %d, exceed the little cores size: %d
\n
"
,
threads
,
small_core_size
)
;
LOG
(
WARNING
)
<<
"threads: "
<<
threads
<<
", exceed the little cores size: "
<<
small_core_size
;
active_ids_
=
dev
.
little_core_ids_
;
}
else
{
for
(
int
i
=
0
;
i
<
threads
;
++
i
)
{
...
...
@@ -251,7 +256,7 @@ void Context<TargetType::kARM>::SetRunMode(PowerMode mode, int threads) {
}
}
else
{
mode_
=
LITE_POWER_HIGH
;
LOG
W
(
"LOW POWER MODE is not support, switch to big cores
\n
"
)
;
LOG
(
WARNING
)
<<
"LOW POWER MODE is not support, switch to big cores"
;
if
(
threads
>
big_core_size
)
{
active_ids_
=
dev
.
big_core_ids_
;
}
else
{
...
...
paddle/fluid/lite/kernels/arm/conv_compute.cc
浏览文件 @
16c33ef4
...
...
@@ -28,6 +28,8 @@ void ConvCompute::PrepareForRun() {
auto
o_dims
=
param
.
output
->
dims
();
auto
&
ctx
=
this
->
ctx_
->
template
As
<
ARMContext
>();
// TODO(xxx): make api and expose it
ctx
.
SetRunMode
(
LITE_POWER_HIGH
,
4
);
int
win
=
x_dims
[
3
];
// nchw
int
hin
=
x_dims
[
2
];
...
...
paddle/fluid/lite/kernels/arm/fc_compute.cc
浏览文件 @
16c33ef4
...
...
@@ -27,6 +27,9 @@ void FcCompute::PrepareForRun() {
auto
x_dims
=
param
.
input
->
dims
();
auto
w_dims
=
param
.
w
->
dims
();
auto
&
ctx
=
this
->
ctx_
->
template
As
<
ARMContext
>();
ctx
.
SetRunMode
(
LITE_POWER_HIGH
,
4
);
CHECK_GE
(
x_dims
.
size
(),
2UL
);
CHECK_EQ
(
w_dims
.
size
(),
2UL
);
CHECK_EQ
(
param
.
output
->
dims
().
size
(),
2UL
);
...
...
paddle/fluid/lite/kernels/arm/mul_compute.cc
浏览文件 @
16c33ef4
...
...
@@ -23,7 +23,8 @@ namespace kernels {
namespace
arm
{
void
MulCompute
::
PrepareForRun
()
{
// TODO(TJ): transpose x or y if necessary
auto
&
ctx
=
this
->
ctx_
->
template
As
<
ARMContext
>();
ctx
.
SetRunMode
(
LITE_POWER_HIGH
,
4
);
}
void
MulCompute
::
Run
()
{
...
...
paddle/fluid/lite/kernels/arm/pool_compute.cc
浏览文件 @
16c33ef4
...
...
@@ -24,6 +24,11 @@ namespace lite {
namespace
kernels
{
namespace
arm
{
void
PoolCompute
::
PrepareForRun
()
{
auto
&
ctx
=
this
->
ctx_
->
template
As
<
ARMContext
>();
ctx
.
SetRunMode
(
LITE_POWER_HIGH
,
4
);
}
void
PoolCompute
::
Run
()
{
auto
&
param
=
Param
<
operators
::
PoolParam
>
();
auto
&
in_dims
=
param
.
x
->
dims
();
...
...
paddle/fluid/lite/kernels/arm/pool_compute.h
浏览文件 @
16c33ef4
...
...
@@ -26,6 +26,7 @@ class PoolCompute : public KernelLite<TARGET(kARM), PRECISION(kFloat)> {
public:
using
param_t
=
operators
::
PoolParam
;
void
PrepareForRun
()
override
;
void
Run
()
override
;
TargetType
target
()
const
override
;
...
...
paddle/fluid/lite/tools/build.sh
浏览文件 @
16c33ef4
...
...
@@ -56,7 +56,7 @@ function check_style {
function
cmake_arm
{
# $1: ARM_TARGET_OS in "android" , "armlinux"
# $2: ARM_TARGET_ARCH_ABI in "arm
64-v8a", "armeabi-v7a" ,"armeabi-v7a-
hf"
# $2: ARM_TARGET_ARCH_ABI in "arm
v8", "armv7" ,"armv7
hf"
cmake ..
\
-DWITH_GPU
=
OFF
\
-DWITH_MKL
=
OFF
\
...
...
@@ -123,31 +123,24 @@ function test_arm_android {
# Build the code and run lite arm tests. This is executed in the CI system.
function
build_test_arm
{
port_armv8
=
5554
port_armv7
=
5556
adb kill-server
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
# 1. Build goes first
cur_dir
=
$(
pwd
)
for
os
in
"android"
"armlinux"
;
do
for
abi
in
"arm64-v8a"
"armeabi-v7a"
"armeabi-v7a-hf"
;
do
# TODO(TJ): enable compile on v7-hf on andorid and all v7 on armlinux
if
[[
${
abi
}
==
"armeabi-v7a-hf"
]]
;
then
echo
"armeabi-v7a-hf is not supported on both android and armlinux"
for
abi
in
"armv8"
"armv7"
"armv7hf"
;
do
# TODO(hongming): enable compile armv7 and armv7hf on armlinux
if
[[
${
abi
}
==
"armv7hf"
]]
;
then
echo
"armv7hf is not supported on both android and armlinux yet"
continue
fi
# TODO(hongming): enable armv7 on armlinux
if
[[
${
os
}
==
"armlinux"
&&
${
abi
}
==
"armv7"
]]
;
then
echo
"armv7 is not supported on armlinux yet"
continue
fi
if
[[
${
os
}
==
"a
rmlinux"
&&
${
abi
}
==
"armeabi-v7a
"
]]
;
then
echo
"a
rmeabi-v7a is not supported on armlinux yet
"
if
[[
${
os
}
==
"a
ndroid"
&&
${
abi
}
==
"armv7hf
"
]]
;
then
echo
"a
ndroid do not need armv7hf
"
continue
fi
...
...
@@ -157,34 +150,50 @@ function build_test_arm {
cmake_arm
${
os
}
${
abi
}
build
$TESTS_FILE
done
done
# armlinux need in another docker
# TODO(TJ): enable test with armlinux
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 all armv7 tests
# TODO(TJ): enable test with armv7
continue
fi
local
port
=
if
[[
${
adb_abi
}
==
"armeabi-v7a"
]]
;
then
port
=
${
port_armv7
}
fi
if
[[
${
adb_abi
}
==
"arm64-v8a"
]]
;
then
port
=
${
port_armv8
}
fi
echo
"test file:
${
TESTS_FILE
}
"
for
_test
in
$(
cat
$TESTS_FILE
)
;
do
test_arm_android
$_test
$port
done
fi
# 2. Then test
port_armv8
=
5554
port_armv7
=
5556
adb kill-server
adb devices |
grep
emulator |
cut
-f1
|
while
read
line
;
do
adb
-s
$line
emu
kill
;
done
# start android armv8 and armv7 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
# now can only test android.
for
abi
in
"armv8"
"armv7"
;
do
# TODO(yuanshuai): enable armv7 on android
if
[[
${
abi
}
==
"armv7"
]]
;
then
continue
fi
build_dir
=
$cur_dir
/build.lite.android.
${
abi
}
cd
$build_dir
local
port
=
if
[[
${
abi
}
==
"armv7"
]]
;
then
port
=
${
port_armv7
}
fi
if
[[
${
abi
}
==
"armv8"
]]
;
then
port
=
${
port_armv8
}
fi
echo
"test file:
${
TESTS_FILE
}
"
for
_test
in
$(
cat
$TESTS_FILE
)
;
do
test_arm_android
$_test
$port
done
done
# armlinux need in another docker
# TODO(hongming): enable test armlinux on armv8, armv7 and armv7hf
adb devices |
grep
emulator |
cut
-f1
|
while
read
line
;
do
adb
-s
$line
emu
kill
;
done
echo
"Done"
}
...
...
paddle/fluid/lite/tools/mobile_readme.md
浏览文件 @
16c33ef4
...
...
@@ -17,8 +17,15 @@ $ git checkout incubate/lite
### 主要cmake选项
-
`ARM_TARGET_OS`
代表目标操作系统, 目前支持 "android" "armlinux", 模型是Android
-
`ARM_TARGET_ARCH_ABI`
代表ARCH, 目前支持 "arm64-v8a" "armeabi-v7a"。 模型是arm64-v8a
-
`ARM_TARGET_OS`
代表目标操作系统, 目前支持 "android" "armlinux", 默认是Android
-
`ARM_TARGET_ARCH_ABI`
代表ARCH,支持输入"armv8"和"armv7",针对OS不一样选择不一样。
-
`-DARM_TARGET_OS="android"`
时
-
"armv8", 等效于 "arm64-v8a"。 default值为这个。
-
"armv7", 等效于 "armeabi-v7a"。
-
`-DARM_TARGET_OS="armlinux"`
时
-
"armv8", 等效于 "arm64"。 default值为这个。
-
"armv7hf", 等效于使用
`eabihf`
且
`-march=armv7-a -mfloat-abi=hard -mfpu=neon-vfpv4 `
。
-
"armv7", 等效于使用
`eabi`
且
`-march=armv7-a -mfloat-abi=softfp -mfpu=neon-vfpv4`
。
### 编译
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录