Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
孤小逸
Mace
提交
50507bd1
Mace
项目概览
孤小逸
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
1
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
50507bd1
编写于
5月 03, 2018
作者:
W
wuchenghui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Enable valgrind memory leak check in mace_run
上级
5e02dc0e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
52 addition
and
11 deletion
+52
-11
tools/bazel_adb_run.py
tools/bazel_adb_run.py
+1
-1
tools/mace_tools.py
tools/mace_tools.py
+29
-1
tools/sh_commands.py
tools/sh_commands.py
+22
-9
未找到文件。
tools/bazel_adb_run.py
浏览文件 @
50507bd1
...
...
@@ -91,7 +91,7 @@ def parse_args():
parser
.
add_argument
(
"--valgrind_path"
,
type
=
str
,
default
=
"/data/local/valgrind"
,
default
=
"/data/local/
tmp/
valgrind"
,
help
=
"Valgrind install path."
)
parser
.
add_argument
(
"--valgrind_args"
,
...
...
tools/mace_tools.py
浏览文件 @
50507bd1
...
...
@@ -197,7 +197,10 @@ def tuning_run(runtime,
omp_num_threads
,
cpu_affinity_policy
,
gpu_perf_hint
,
gpu_priority_hint
gpu_priority_hint
,
valgrind
=
FLAGS
.
valgrind
,
valgrind_path
=
FLAGS
.
valgrind_path
,
valgrind_args
=
FLAGS
.
valgrind_args
)
if
running_round
>
0
and
FLAGS
.
collect_report
:
...
...
@@ -213,6 +216,12 @@ def build_mace_run_prod(hexagon_mode, runtime, target_abi,
limit_opencl_kernel_time
,
phone_data_dir
,
enable_openmp
):
mace_run_target
=
"//mace/tools/validation:mace_run"
strip
=
"always"
debug
=
False
if
FLAGS
.
valgrind
:
strip
=
"never"
debug
=
True
if
runtime
==
"gpu"
:
gen_opencl_and_tuning_code
(
target_abi
,
serialno
,
[],
False
)
sh_commands
.
bazel_build
(
...
...
@@ -243,10 +252,12 @@ def build_mace_run_prod(hexagon_mode, runtime, target_abi,
True
)
sh_commands
.
bazel_build
(
mace_run_target
,
strip
,
abi
=
target_abi
,
model_tag
=
model_name
,
production_mode
=
True
,
hexagon_mode
=
hexagon_mode
,
debug
=
debug
,
enable_openmp
=
enable_openmp
)
sh_commands
.
update_mace_run_lib
(
model_output_dir
,
target_abi
,
...
...
@@ -255,10 +266,12 @@ def build_mace_run_prod(hexagon_mode, runtime, target_abi,
gen_opencl_and_tuning_code
(
target_abi
,
serialno
,
[],
False
)
sh_commands
.
bazel_build
(
mace_run_target
,
strip
,
abi
=
target_abi
,
model_tag
=
model_name
,
production_mode
=
True
,
hexagon_mode
=
hexagon_mode
,
debug
=
debug
,
enable_openmp
=
enable_openmp
)
sh_commands
.
update_mace_run_lib
(
model_output_dir
,
target_abi
,
...
...
@@ -490,6 +503,21 @@ def parse_args():
type
=
str_to_caffe_env_type
,
default
=
'docker'
,
help
=
"[docker | local] caffe environment."
)
parser
.
add_argument
(
"--valgrind"
,
type
=
bool
,
default
=
False
,
help
=
"Whether to use valgrind to check memory error."
)
parser
.
add_argument
(
"--valgrind_path"
,
type
=
str
,
default
=
"/data/local/tmp/valgrind"
,
help
=
"Valgrind install path."
)
parser
.
add_argument
(
"--valgrind_args"
,
type
=
str
,
default
=
""
,
help
=
"Valgrind command args."
)
return
parser
.
parse_known_args
()
...
...
tools/sh_commands.py
浏览文件 @
50507bd1
...
...
@@ -216,7 +216,7 @@ def adb_run(serialno,
def
adb_run_valgrind
(
serialno
,
host_bin_path
,
bin_name
,
valgrind_path
=
"/data/local/valgrind"
,
valgrind_path
=
"/data/local/
tmp/
valgrind"
,
valgrind_args
=
""
,
args
=
""
,
opencl_profiling
=
1
,
...
...
@@ -581,6 +581,9 @@ def tuning_run(abi,
cpu_affinity_policy
=
1
,
gpu_perf_hint
=
3
,
gpu_priority_hint
=
3
,
valgrind
=
False
,
valgrind_path
=
"/data/local/tmp/valgrind"
,
valgrind_args
=
""
,
input_file_name
=
"model_input"
,
output_file_name
=
"model_out"
):
print
(
"* Run '%s' with round=%s, restart_round=%s, tuning=%s, "
...
...
@@ -637,19 +640,22 @@ def tuning_run(abi,
stdout_buff
=
[]
process_output
=
make_output_processor
(
stdout_buff
)
p
=
sh
.
adb
(
"-s"
,
serialno
,
"shell"
,
adb_cmd
=
[
"LD_LIBRARY_PATH=%s"
%
phone_data_dir
,
"MACE_TUNING=%s"
%
int
(
tuning
),
"MACE_OUT_OF_RANGE_CHECK=%s"
%
int
(
out_of_range_check
),
"MACE_CPP_MIN_VLOG_LEVEL=%s"
%
vlog_level
,
"MACE_RUN_PARAMETER_PATH=%s/mace_run.config"
%
phone_data_dir
,
"MACE_RUN_PARAMETER_PATH=%s/mace_run.config"
%
phone_data_dir
,
"MACE_CL_PROGRAM_PATH=%s/cl_program"
%
phone_data_dir
,
"MACE_LIMIT_OPENCL_KERNEL_TIME=%s"
%
limit_opencl_kernel_time
,
"MACE_LIMIT_OPENCL_KERNEL_TIME=%s"
%
limit_opencl_kernel_time
,
]
if
valgrind
:
adb_cmd
.
extend
([
"VALGRIND_LIB=%s"
%
valgrind_path
+
"/lib/valgrind"
,
valgrind_path
+
"/bin/valgrind"
,
valgrind_args
])
adb_cmd
.
extend
([
"%s/mace_run"
%
phone_data_dir
,
"--input_node=%s"
%
","
.
join
(
input_nodes
),
"--output_node=%s"
%
","
.
join
(
output_nodes
),
...
...
@@ -665,6 +671,13 @@ def tuning_run(abi,
"--cpu_affinity_policy=%s"
%
cpu_affinity_policy
,
"--gpu_perf_hint=%s"
%
gpu_perf_hint
,
"--gpu_priority_hint=%s"
%
gpu_priority_hint
,
])
adb_cmd
=
' '
.
join
(
adb_cmd
)
p
=
sh
.
adb
(
"-s"
,
serialno
,
"shell"
,
adb_cmd
,
_out
=
process_output
,
_bg
=
True
,
_err_to_out
=
True
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录