Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
b7a9fe08
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,发现更多精彩内容 >>
提交
b7a9fe08
编写于
5月 31, 2018
作者:
李
李寅
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'fix-adb-run' into 'master'
Fix adb_run not work for old adb version. See merge request !546
上级
9939c334
a86482d8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
8 addition
and
25 deletion
+8
-25
tools/sh_commands.py
tools/sh_commands.py
+8
-25
未找到文件。
tools/sh_commands.py
浏览文件 @
b7a9fe08
...
@@ -239,9 +239,11 @@ def adb_run(abi,
...
@@ -239,9 +239,11 @@ def adb_run(abi,
"MACE_OUT_OF_RANGE_CHECK=%d"
%
out_of_range_check
,
"MACE_OUT_OF_RANGE_CHECK=%d"
%
out_of_range_check
,
"MACE_OPENCL_PROFILING=%d"
%
opencl_profiling
,
"MACE_OPENCL_PROFILING=%d"
%
opencl_profiling
,
"MACE_CPP_MIN_VLOG_LEVEL=%d"
%
vlog_level
,
"MACE_CPP_MIN_VLOG_LEVEL=%d"
%
vlog_level
,
"%s %s"
%
(
device_bin_full_path
,
args
),
device_bin_full_path
,
args
,
_tty_in
=
True
,
_out
=
process_output
,
_out
=
process_output
,
_
fg
=
True
)
_
err_to_out
=
True
)
return
""
.
join
(
stdout_buff
)
return
""
.
join
(
stdout_buff
)
...
@@ -283,8 +285,6 @@ def bazel_build(target,
...
@@ -283,8 +285,6 @@ def bazel_build(target,
enable_neon
=
True
,
enable_neon
=
True
,
address_sanitizer
=
False
):
address_sanitizer
=
False
):
print
(
"* Build %s with ABI %s"
%
(
target
,
abi
))
print
(
"* Build %s with ABI %s"
%
(
target
,
abi
))
stdout_buff
=
[]
process_output
=
make_output_processor
(
stdout_buff
)
if
abi
==
"host"
:
if
abi
==
"host"
:
bazel_args
=
(
bazel_args
=
(
"build"
,
"build"
,
...
@@ -310,11 +310,9 @@ def bazel_build(target,
...
@@ -310,11 +310,9 @@ def bazel_build(target,
else
:
else
:
bazel_args
+=
(
"--config"
,
"optimization"
)
bazel_args
+=
(
"--config"
,
"optimization"
)
sh
.
bazel
(
sh
.
bazel
(
_out
=
process_output
,
_fg
=
True
,
_fg
=
True
,
*
bazel_args
)
*
bazel_args
)
print
(
"Build done!
\n
"
)
print
(
"Build done!
\n
"
)
return
""
.
join
(
stdout_buff
)
def
bazel_build_common
(
target
,
build_args
=
""
):
def
bazel_build_common
(
target
,
build_args
=
""
):
...
@@ -323,8 +321,9 @@ def bazel_build_common(target, build_args=""):
...
@@ -323,8 +321,9 @@ def bazel_build_common(target, build_args=""):
sh
.
bazel
(
sh
.
bazel
(
"build"
,
"build"
,
target
+
build_args
,
target
+
build_args
,
_tty_in
=
True
,
_out
=
process_output
,
_out
=
process_output
,
_
fg
=
True
)
_
err_to_out
=
True
)
return
""
.
join
(
stdout_buff
)
return
""
.
join
(
stdout_buff
)
...
@@ -456,8 +455,6 @@ def gen_model_code(model_codegen_dir,
...
@@ -456,8 +455,6 @@ def gen_model_code(model_codegen_dir,
sh
.
rm
(
"-rf"
,
model_codegen_dir
)
sh
.
rm
(
"-rf"
,
model_codegen_dir
)
sh
.
mkdir
(
"-p"
,
model_codegen_dir
)
sh
.
mkdir
(
"-p"
,
model_codegen_dir
)
stdout_buff
=
[]
process_output
=
make_output_processor
(
stdout_buff
)
sh
.
python
(
"bazel-bin/mace/python/tools/converter"
,
sh
.
python
(
"bazel-bin/mace/python/tools/converter"
,
"-u"
,
"-u"
,
"--platform=%s"
%
platform
,
"--platform=%s"
%
platform
,
...
@@ -478,7 +475,6 @@ def gen_model_code(model_codegen_dir,
...
@@ -478,7 +475,6 @@ def gen_model_code(model_codegen_dir,
"--output_dir=%s"
%
model_codegen_dir
,
"--output_dir=%s"
%
model_codegen_dir
,
"--model_build_type=%s"
%
model_build_type
,
"--model_build_type=%s"
%
model_build_type
,
"--data_type=%s"
%
data_type
,
"--data_type=%s"
%
data_type
,
_out
=
process_output
,
_fg
=
True
)
_fg
=
True
)
...
@@ -691,8 +687,9 @@ def tuning_run(abi,
...
@@ -691,8 +687,9 @@ def tuning_run(abi,
serialno
,
serialno
,
"shell"
,
"shell"
,
adb_cmd
,
adb_cmd
,
_tty_in
=
True
,
_out
=
process_output
,
_out
=
process_output
,
_
fg
=
True
)
_
err_to_out
=
True
)
print
(
"Running finished!
\n
"
)
print
(
"Running finished!
\n
"
)
return
""
.
join
(
stdout_buff
)
return
""
.
join
(
stdout_buff
)
...
@@ -792,8 +789,6 @@ def validate_model(abi,
...
@@ -792,8 +789,6 @@ def validate_model(abi,
sh
.
docker
(
"cp"
,
model_file_path
,
"%s:/mace"
%
container_name
)
sh
.
docker
(
"cp"
,
model_file_path
,
"%s:/mace"
%
container_name
)
sh
.
docker
(
"cp"
,
weight_file_path
,
"%s:/mace"
%
container_name
)
sh
.
docker
(
"cp"
,
weight_file_path
,
"%s:/mace"
%
container_name
)
stdout_buff
=
[]
process_output
=
make_output_processor
(
stdout_buff
)
sh
.
docker
(
sh
.
docker
(
"exec"
,
"exec"
,
container_name
,
container_name
,
...
@@ -810,7 +805,6 @@ def validate_model(abi,
...
@@ -810,7 +805,6 @@ def validate_model(abi,
"--output_node=%s"
%
","
.
join
(
output_nodes
),
"--output_node=%s"
%
","
.
join
(
output_nodes
),
"--input_shape=%s"
%
":"
.
join
(
input_shapes
),
"--input_shape=%s"
%
":"
.
join
(
input_shapes
),
"--output_shape=%s"
%
":"
.
join
(
output_shapes
),
"--output_shape=%s"
%
":"
.
join
(
output_shapes
),
_out
=
process_output
,
_fg
=
True
)
_fg
=
True
)
print
(
"Validation done!
\n
"
)
print
(
"Validation done!
\n
"
)
...
@@ -960,15 +954,12 @@ def packaging_lib(libmace_output_dir, project_name):
...
@@ -960,15 +954,12 @@ def packaging_lib(libmace_output_dir, project_name):
print
(
"Start packaging '%s' libs into %s"
%
(
project_name
,
print
(
"Start packaging '%s' libs into %s"
%
(
project_name
,
tar_package_path
))
tar_package_path
))
stdout_buff
=
[]
process_output
=
make_output_processor
(
stdout_buff
)
sh
.
tar
(
sh
.
tar
(
"cvzf"
,
"cvzf"
,
"%s"
%
tar_package_path
,
"%s"
%
tar_package_path
,
glob
.
glob
(
"%s/*"
%
project_dir
),
glob
.
glob
(
"%s/*"
%
project_dir
),
"--exclude"
,
"--exclude"
,
"%s/_tmp"
%
project_dir
,
"%s/_tmp"
%
project_dir
,
_out
=
process_output
,
_fg
=
True
)
_fg
=
True
)
print
(
"Packaging Done!
\n
"
)
print
(
"Packaging Done!
\n
"
)
...
@@ -1011,8 +1002,6 @@ def benchmark_model(abi,
...
@@ -1011,8 +1002,6 @@ def benchmark_model(abi,
input_file_name
=
"model_input"
):
input_file_name
=
"model_input"
):
print
(
"* Benchmark for %s"
%
model_tag
)
print
(
"* Benchmark for %s"
%
model_tag
)
stdout_buff
=
[]
process_output
=
make_output_processor
(
stdout_buff
)
mace_model_path
=
""
mace_model_path
=
""
if
build_type
==
BuildType
.
proto
:
if
build_type
==
BuildType
.
proto
:
mace_model_path
=
"%s/%s.pb"
%
(
mace_model_dir
,
model_tag
)
mace_model_path
=
"%s/%s.pb"
%
(
mace_model_dir
,
model_tag
)
...
@@ -1083,11 +1072,9 @@ def benchmark_model(abi,
...
@@ -1083,11 +1072,9 @@ def benchmark_model(abi,
"--gpu_perf_hint=%s"
%
gpu_perf_hint
,
"--gpu_perf_hint=%s"
%
gpu_perf_hint
,
"--gpu_priority_hint=%s"
%
gpu_priority_hint
,
"--gpu_priority_hint=%s"
%
gpu_priority_hint
,
"--model_file=%s"
%
mace_model_phone_path
,
"--model_file=%s"
%
mace_model_phone_path
,
_out
=
process_output
,
_fg
=
True
)
_fg
=
True
)
print
(
"Benchmark done!
\n
"
)
print
(
"Benchmark done!
\n
"
)
return
""
.
join
(
stdout_buff
)
def
build_run_throughput_test
(
abi
,
def
build_run_throughput_test
(
abi
,
...
@@ -1121,8 +1108,6 @@ def build_run_throughput_test(abi,
...
@@ -1121,8 +1108,6 @@ def build_run_throughput_test(abi,
dsp_model_tag
dsp_model_tag
sh
.
cp
(
"-f"
,
merged_lib_file
,
"mace/benchmark/libmace_merged.a"
)
sh
.
cp
(
"-f"
,
merged_lib_file
,
"mace/benchmark/libmace_merged.a"
)
stdout_buff
=
[]
process_output
=
make_output_processor
(
stdout_buff
)
sh
.
bazel
(
sh
.
bazel
(
"build"
,
"build"
,
"-c"
,
"-c"
,
...
@@ -1143,7 +1128,6 @@ def build_run_throughput_test(abi,
...
@@ -1143,7 +1128,6 @@ def build_run_throughput_test(abi,
"--define"
,
"--define"
,
"openmp=true"
,
"openmp=true"
,
model_tag_build_flag
,
model_tag_build_flag
,
_out
=
process_output
,
_fg
=
True
)
_fg
=
True
)
sh
.
rm
(
"mace/benchmark/libmace_merged.a"
)
sh
.
rm
(
"mace/benchmark/libmace_merged.a"
)
...
@@ -1195,7 +1179,6 @@ def build_run_throughput_test(abi,
...
@@ -1195,7 +1179,6 @@ def build_run_throughput_test(abi,
"--dsp_model_data_file=%s/%s.data"
%
(
phone_data_dir
,
"--dsp_model_data_file=%s/%s.data"
%
(
phone_data_dir
,
dsp_model_tag
),
dsp_model_tag
),
"--run_seconds=%s"
%
run_seconds
,
"--run_seconds=%s"
%
run_seconds
,
_out
=
process_output
,
_fg
=
True
)
_fg
=
True
)
print
(
"throughput_test done!
\n
"
)
print
(
"throughput_test done!
\n
"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录