Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
911c103e
Mace
项目概览
Xiaomi
/
Mace
通知
106
Star
40
Fork
27
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Mace
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
911c103e
编写于
7月 19, 2018
作者:
刘
刘琦
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'update_libmace_build' into 'master'
update generic library outputs and android demo See merge request !674
上级
ee80dbc3
4521ecf8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
18 deletion
+47
-18
docs/user_guide/basic_usage.rst
docs/user_guide/basic_usage.rst
+7
-0
mace/examples/android/build.sh
mace/examples/android/build.sh
+19
-6
tools/build-standalone-lib.sh
tools/build-standalone-lib.sh
+21
-12
未找到文件。
docs/user_guide/basic_usage.rst
浏览文件 @
911c103e
...
@@ -47,6 +47,13 @@ Here we use the mobilenet-v2 model as an example.
...
@@ -47,6 +47,13 @@ Here we use the mobilenet-v2 model as an example.
bash tools/build-standalone-lib.sh
bash tools/build-standalone-lib.sh
.. note::
- Libraries in ``builds/lib/armeabi-v7a/cpu_gpu/`` means it can run on ``cpu`` or ``gpu`` devices.
- The results in ``builds/lib/armeabi-v7a/cpu_gpu_dsp/`` need HVX supported.
4. Convert the pre-trained mobilenet-v2 model to MACE format model.
4. Convert the pre-trained mobilenet-v2 model to MACE format model.
.. code:: sh
.. code:: sh
...
...
mace/examples/android/build.sh
浏览文件 @
911c103e
...
@@ -4,13 +4,26 @@ set -e -u -o pipefail
...
@@ -4,13 +4,26 @@ set -e -u -o pipefail
pushd
../../../
pushd
../../../
python tools/converter.py convert
--config
=
mace/examples/android/mobilenet.yml
TARGET_ABI
=
arm64-v8a
cp
-rf
builds/mobilenet/include mace/examples/android/macelibrary/src/main/cpp/
LIBRARY_DIR
=
mace/examples/android/macelibrary/src/main/cpp/
cp
-rf
builds/mobilenet/model mace/examples/android/macelibrary/src/main/cpp/
INCLUDE_DIR
=
$LIBRARY_DIR
/include/mace/public/
LIBMACE_DIR
=
$LIBRARY_DIR
/lib/
$TARGET_ABI
/
bash tools/build-standalone-lib.sh
rm
-rf
$LIBRARY_DIR
/include/
cp
-rf
builds/include mace/examples/android/macelibrary/src/main/cpp/
mkdir
-p
$INCLUDE_DIR
cp
-rf
builds/lib mace/examples/android/macelibrary/src/main/cpp/
rm
-rf
$LIBRARY_DIR
/lib/
mkdir
-p
$LIBMACE_DIR
rm
-rf
$LIBRARY_DIR
/model/
python tools/converter.py convert
--config
=
mace/examples/android/mobilenet.yml
--target_abis
=
$TARGET_ABI
cp
-rf
builds/mobilenet/include/mace/public/
*
.h
$INCLUDE_DIR
cp
-rf
builds/mobilenet/model
$LIBRARY_DIR
bazel build
--config
android
--config
optimization mace/libmace:libmace_static
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--cpu
=
$TARGET_ABI
cp
-rf
mace/public/
*
.h
$INCLUDE_DIR
cp
-rf
bazel-genfiles/mace/libmace/libmace.a
$LIBMACE_DIR
popd
popd
...
...
tools/build-standalone-lib.sh
浏览文件 @
911c103e
...
@@ -13,23 +13,28 @@ cp mace/public/*.h $INCLUDE_DIR/
...
@@ -13,23 +13,28 @@ cp mace/public/*.h $INCLUDE_DIR/
# make directories
# make directories
rm
-rf
$LIB_DIR
/armeabi-v7a
rm
-rf
$LIB_DIR
/armeabi-v7a
mkdir
-p
$LIB_DIR
/armeabi-v7a
mkdir
-p
$LIB_DIR
/armeabi-v7a/cpu_gpu_dsp
mkdir
-p
$LIB_DIR
/armeabi-v7a/cpu_gpu
rm
-rf
$LIB_DIR
/arm64-v8a
rm
-rf
$LIB_DIR
/arm64-v8a
mkdir
-p
$LIB_DIR
/arm64-v8a
mkdir
-p
$LIB_DIR
/arm64-v8a
/cpu_gpu
rm
-rf
$LIB_DIR
/linux-x86-64
rm
-rf
$LIB_DIR
/linux-x86-64
mkdir
-p
$LIB_DIR
/linux-x86-64
mkdir
-p
$LIB_DIR
/linux-x86-64
# build shared libraries
# build shared libraries
echo
"build shared lib for armeabi-v7a"
echo
"build shared lib for armeabi-v7a
+ cpu_gpu_dsp
"
bazel build
--config
android
--config
optimization mace/libmace:libmace_dynamic
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--define
hexagon
=
true
--cpu
=
armeabi-v7a
bazel build
--config
android
--config
optimization mace/libmace:libmace_dynamic
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--define
hexagon
=
true
--cpu
=
armeabi-v7a
cp
bazel-bin/mace/libmace/libmace.so
$LIB_DIR
/armeabi-v7a/
cp
bazel-bin/mace/libmace/libmace.so
$LIB_DIR
/armeabi-v7a/
cpu_gpu_dsp/
cp
third_party/nnlib/
*
so
$LIB_DIR
/armeabi-v7a/
cp
third_party/nnlib/
*
so
$LIB_DIR
/armeabi-v7a/
cpu_gpu_dsp/
echo
"build shared lib for arm64-v8a"
echo
"build shared lib for armeabi-v7a + cpu_gpu"
bazel build
--config
android
--config
optimization mace/libmace:libmace_dynamic
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--cpu
=
armeabi-v7a
cp
bazel-bin/mace/libmace/libmace.so
$LIB_DIR
/armeabi-v7a/cpu_gpu/
echo
"build shared lib for arm64-v8a + cpu_gpu"
bazel build
--config
android
--config
optimization mace/libmace:libmace_dynamic
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--cpu
=
arm64-v8a
bazel build
--config
android
--config
optimization mace/libmace:libmace_dynamic
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--cpu
=
arm64-v8a
cp
bazel-bin/mace/libmace/libmace.so
$LIB_DIR
/arm64-v8a/
cp
bazel-bin/mace/libmace/libmace.so
$LIB_DIR
/arm64-v8a/
cpu_gpu/
if
[[
"
$OSTYPE
"
!=
"darwin"
*
]]
;
then
if
[[
"
$OSTYPE
"
!=
"darwin"
*
]]
;
then
echo
"build shared lib for linux-x86-64"
echo
"build shared lib for linux-x86-64"
...
@@ -38,14 +43,18 @@ if [[ "$OSTYPE" != "darwin"* ]];then
...
@@ -38,14 +43,18 @@ if [[ "$OSTYPE" != "darwin"* ]];then
fi
fi
# build static libraries
# build static libraries
echo
"build static lib for armeabi-v7a"
echo
"build static lib for armeabi-v7a
+ cpu_gpu_dsp
"
bazel build
--config
android
--config
optimization mace/libmace:libmace_static
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--define
hexagon
=
true
--cpu
=
armeabi-v7a
bazel build
--config
android
--config
optimization mace/libmace:libmace_static
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--define
hexagon
=
true
--cpu
=
armeabi-v7a
cp
bazel-genfiles/mace/libmace/libmace.a
$LIB_DIR
/armeabi-v7a/
cp
bazel-genfiles/mace/libmace/libmace.a
$LIB_DIR
/armeabi-v7a/cpu_gpu_dsp/
cp
third_party/nnlib/
*
so
$LIB_DIR
/armeabi-v7a/
cp
third_party/nnlib/
*
so
$LIB_DIR
/armeabi-v7a/cpu_gpu_dsp/
echo
"build static lib for armeabi-v7a + cpu_gpu"
bazel build
--config
android
--config
optimization mace/libmace:libmace_static
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--cpu
=
armeabi-v7a
cp
bazel-genfiles/mace/libmace/libmace.a
$LIB_DIR
/armeabi-v7a/cpu_gpu/
echo
"build static lib for arm64-v8a"
echo
"build static lib for arm64-v8a
+ cpu_gpu
"
bazel build
--config
android
--config
optimization mace/libmace:libmace_static
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--cpu
=
arm64-v8a
bazel build
--config
android
--config
optimization mace/libmace:libmace_static
--define
neon
=
true
--define
openmp
=
true
--define
opencl
=
true
--cpu
=
arm64-v8a
cp
bazel-genfiles/mace/libmace/libmace.a
$LIB_DIR
/arm64-v8a/
cp
bazel-genfiles/mace/libmace/libmace.a
$LIB_DIR
/arm64-v8a/
cpu_gpu/
if
[[
"
$OSTYPE
"
!=
"darwin"
*
]]
;
then
if
[[
"
$OSTYPE
"
!=
"darwin"
*
]]
;
then
echo
"build static lib for linux-x86-64"
echo
"build static lib for linux-x86-64"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录