Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
0b1021c6
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,发现更多精彩内容 >>
提交
0b1021c6
编写于
12月 19, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add MT test for GPU Context and update the API document.
上级
021dbc5b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
2 deletion
+17
-2
mace/ops/ops_test_util.cc
mace/ops/ops_test_util.cc
+9
-1
mace/public/mace.h
mace/public/mace.h
+3
-0
mace/test/mace_api_mt_test.cc
mace/test/mace_api_mt_test.cc
+1
-1
tools/device.py
tools/device.py
+4
-0
未找到文件。
mace/ops/ops_test_util.cc
浏览文件 @
0b1021c6
...
...
@@ -100,6 +100,14 @@ void OpDefBuilder::Finalize(OperatorDef *op_def) const {
*
op_def
=
op_def_
;
}
namespace
{
std
::
string
GetStoragePathFromEnv
()
{
char
*
storage_path_str
=
getenv
(
"MACE_INTERNAL_STORAGE_PATH"
);
if
(
storage_path_str
==
nullptr
)
return
""
;
return
storage_path_str
;
}
}
// namespace
OpTestContext
*
OpTestContext
::
Get
(
int
num_threads
,
CPUAffinityPolicy
cpu_affinity_policy
,
bool
use_gemmlowp
)
{
...
...
@@ -112,7 +120,7 @@ OpTestContext *OpTestContext::Get(int num_threads,
OpTestContext
::
OpTestContext
(
int
num_threads
,
CPUAffinityPolicy
cpu_affinity_policy
,
bool
use_gemmlowp
)
:
gpu_context_
(
new
GPUContext
()),
:
gpu_context_
(
new
GPUContext
(
GetStoragePathFromEnv
()
)),
opencl_mem_types_
({
MemoryType
::
GPU_IMAGE
})
{
device_map_
[
DeviceType
::
CPU
]
=
std
::
unique_ptr
<
Device
>
(
new
CPUDevice
(
num_threads
,
...
...
mace/public/mace.h
浏览文件 @
0b1021c6
...
...
@@ -146,6 +146,9 @@ class MaceStatus {
///
/// There are some data in common between different MaceEngines using GPU,
/// use one GPUContext could avoid duplication.
///
/// Thread-safe.
/// You could use one GPUContext for multiple parallel MaceEngines.
class
GPUContext
;
/// \brief GPUContext builder.
...
...
mace/test/mace_api_mt_test.cc
浏览文件 @
0b1021c6
...
...
@@ -39,7 +39,6 @@ void MaceRunFunc(const int in_out_size) {
std
::
shared_ptr
<
NetDef
>
net_def
(
new
NetDef
());
std
::
vector
<
half
>
data
;
ops
::
test
::
GenerateRandomRealTypeData
<
half
>
(
filter_shape
,
&
data
);
AddTensor
<
half
>
(
...
...
@@ -63,6 +62,7 @@ void MaceRunFunc(const int in_out_size) {
}
MaceEngineConfig
config
(
DeviceType
::
GPU
);
config
.
SetGPUContext
(
mace
::
ops
::
test
::
OpTestContext
::
Get
()
->
gpu_context
());
MaceEngine
engine
(
config
);
MaceStatus
status
=
engine
.
Init
(
net_def
.
get
(),
input_names
,
output_names
,
...
...
tools/device.py
浏览文件 @
0b1021c6
...
...
@@ -901,6 +901,8 @@ class DeviceWrapper:
stdout_buf
=
[]
process_output
=
sh_commands
.
make_output_processor
(
stdout_buf
)
internal_storage_dir
=
self
.
create_internal_storage_dir
()
if
simpleperf
and
self
.
system
==
SystemType
.
android
:
self
.
push
(
sh_commands
.
find_simpleperf_library
(
abi
),
self
.
data_dir
)
...
...
@@ -909,6 +911,7 @@ class DeviceWrapper:
ld_preload
,
'MACE_OUT_OF_RANGE_CHECK=%s'
%
out_of_range_check
,
'MACE_OPENCL_PROFILING=%d'
%
opencl_profiling
,
'MACE_INTERNAL_STORAGE_PATH=%s'
%
internal_storage_dir
,
'MACE_CPP_MIN_VLOG_LEVEL=%d'
%
vlog_level
,
simpleperf_cmd
,
'stat'
,
...
...
@@ -928,6 +931,7 @@ class DeviceWrapper:
ld_preload
,
'MACE_OUT_OF_RANGE_CHECK=%d'
%
out_of_range_check
,
'MACE_OPENCL_PROFILNG=%d'
%
opencl_profiling
,
'MACE_INTERNAL_STORAGE_PATH=%s'
%
internal_storage_dir
,
'MACE_CPP_MIN_VLOG_LEVEL=%d'
%
vlog_level
,
device_bin_full_path
,
args
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录