Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Xiaomi
Mace
提交
75b995b5
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,发现更多精彩内容 >>
提交
75b995b5
编写于
7月 12, 2018
作者:
Y
yejianwu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix benchmark, avoid alwayslink for mace:core
上级
50636e91
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
73 addition
and
34 deletion
+73
-34
mace/benchmark/BUILD
mace/benchmark/BUILD
+1
-1
mace/core/BUILD
mace/core/BUILD
+0
-2
mace/core/runtime/cpu/cpu_runtime.cc
mace/core/runtime/cpu/cpu_runtime.cc
+0
-17
mace/core/runtime/opencl/opencl_runtime.cc
mace/core/runtime/opencl/opencl_runtime.cc
+4
-12
mace/core/testing/test_benchmark_main.cc
mace/core/testing/test_benchmark_main.cc
+4
-2
mace/libmace/mace_runtime.cc
mace/libmace/mace_runtime.cc
+64
-0
未找到文件。
mace/benchmark/BUILD
浏览文件 @
75b995b5
...
...
@@ -36,7 +36,7 @@ cc_binary(
"//external:gflags_nothreads"
,
"//mace/codegen:generated_models"
,
"//mace/codegen:generated_mace_engine_factory"
,
"//mace/
ops:ops
"
,
"//mace/
libmace:libmace
"
,
],
)
...
...
mace/core/BUILD
浏览文件 @
75b995b5
...
...
@@ -70,7 +70,6 @@ cc_library(
])
+
if_hexagon_enabled
([
"//third_party/nnlib:libhexagon"
,
]),
alwayslink
=
1
,
)
cc_library
(
...
...
@@ -109,5 +108,4 @@ cc_library(
"//external:gflags_nothreads"
,
"//mace/utils"
,
],
alwayslink
=
1
,
)
mace/core/runtime/cpu/cpu_runtime.cc
浏览文件 @
75b995b5
...
...
@@ -206,22 +206,5 @@ MaceStatus SetOpenMPThreadsAndAffinityPolicy(int omp_num_threads_hint,
return
SetOpenMPThreadsAndAffinityCPUs
(
omp_num_threads_hint
,
use_cpu_ids
);
}
MaceStatus
SetOpenMPThreadPolicy
(
int
num_threads_hint
,
CPUAffinityPolicy
policy
)
{
VLOG
(
1
)
<<
"Set OpenMP threads number hint: "
<<
num_threads_hint
<<
", affinity policy: "
<<
policy
;
return
SetOpenMPThreadsAndAffinityPolicy
(
num_threads_hint
,
policy
);
}
MaceStatus
SetOpenMPThreadAffinity
(
int
num_threads
,
const
std
::
vector
<
int
>
&
cpu_ids
)
{
return
SetOpenMPThreadsAndAffinityCPUs
(
num_threads
,
cpu_ids
);
}
MaceStatus
GetBigLittleCoreIDs
(
std
::
vector
<
int
>
*
big_core_ids
,
std
::
vector
<
int
>
*
little_core_ids
)
{
return
GetCPUBigLittleCoreIDs
(
big_core_ids
,
little_core_ids
);
}
}
// namespace mace
mace/core/runtime/opencl/opencl_runtime.cc
浏览文件 @
75b995b5
...
...
@@ -33,20 +33,12 @@
namespace
mace
{
extern
const
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
char
>>
kEncryptedProgramMap
;
std
::
shared_ptr
<
KVStorageFactory
>
kStorageFactory
=
nullptr
;
void
SetGPUHints
(
GPUPerfHint
gpu_perf_hint
,
GPUPriorityHint
gpu_priority_hint
)
{
VLOG
(
1
)
<<
"Set GPU configurations, gpu_perf_hint: "
<<
gpu_perf_hint
<<
", gpu_priority_hint: "
<<
gpu_priority_hint
;
OpenCLRuntime
::
Configure
(
gpu_perf_hint
,
gpu_priority_hint
);
}
// Set OpenCL Compiled Binary paths, just call once. (Not thread-safe)
void
SetOpenCLBinaryPaths
(
const
std
::
vector
<
std
::
string
>
&
paths
)
{
OpenCLRuntime
::
ConfigureOpenCLBinaryPath
(
paths
);
}
std
::
string
kOpenCLParameterPath
;
// NOLINT(runtime/string)
extern
const
std
::
map
<
std
::
string
,
std
::
vector
<
unsigned
char
>>
kEncryptedProgramMap
;
const
std
::
string
OpenCLErrorToString
(
cl_int
error
)
{
switch
(
error
)
{
...
...
mace/core/testing/test_benchmark_main.cc
浏览文件 @
75b995b5
...
...
@@ -15,6 +15,8 @@
#include <iostream>
#include "gflags/gflags.h"
#include "mace/core/runtime/cpu/cpu_runtime.h"
#include "mace/core/runtime/opencl/opencl_runtime.h"
#include "mace/core/testing/test_benchmark.h"
#include "mace/public/mace.h"
#include "mace/public/mace_runtime.h"
...
...
@@ -34,13 +36,13 @@ int main(int argc, char **argv) {
gflags
::
ParseCommandLineFlags
(
&
argc
,
&
argv
,
true
);
// config runtime
mace
::
MaceStatus
status
=
mace
::
SetOpenMPThreadPolicy
(
mace
::
MaceStatus
status
=
mace
::
SetOpenMPThread
sAndAffinity
Policy
(
FLAGS_omp_num_threads
,
static_cast
<
mace
::
CPUAffinityPolicy
>
(
FLAGS_cpu_affinity_policy
));
if
(
status
!=
mace
::
MACE_SUCCESS
)
{
LOG
(
WARNING
)
<<
"Set openmp or cpu affinity failed."
;
}
mace
::
SetGPUHints
(
mace
::
OpenCLRuntime
::
Configure
(
static_cast
<
mace
::
GPUPerfHint
>
(
FLAGS_gpu_perf_hint
),
static_cast
<
mace
::
GPUPriorityHint
>
(
FLAGS_gpu_priority_hint
));
...
...
mace/
cor
e/mace_runtime.cc
→
mace/
libmac
e/mace_runtime.cc
浏览文件 @
75b995b5
...
...
@@ -12,22 +12,53 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "mace/core/runtime/cpu/cpu_runtime.h"
#include "mace/core/runtime/opencl/opencl_runtime.h"
#include "mace/public/mace_runtime.h"
#include "mace/utils/logging.h"
namespace
mace
{
std
::
shared_ptr
<
KVStorageFactory
>
kStorageFactory
=
nullptr
;
extern
std
::
shared_ptr
<
KVStorageFactory
>
kStorageFactory
;
void
SetKVStorageFactory
(
std
::
shared_ptr
<
KVStorageFactory
>
storage_factory
)
{
VLOG
(
1
)
<<
"Set internal KV Storage Engine"
;
kStorageFactory
=
storage_factory
;
}
std
::
string
kOpenCLParameterPath
;
// NOLINT(runtime/string)
// Set OpenCL Compiled Binary paths, just call once. (Not thread-safe)
void
SetOpenCLBinaryPaths
(
const
std
::
vector
<
std
::
string
>
&
paths
)
{
OpenCLRuntime
::
ConfigureOpenCLBinaryPath
(
paths
);
}
extern
std
::
string
kOpenCLParameterPath
;
void
SetOpenCLParameterPath
(
const
std
::
string
&
path
)
{
kOpenCLParameterPath
=
path
;
}
void
SetGPUHints
(
GPUPerfHint
gpu_perf_hint
,
GPUPriorityHint
gpu_priority_hint
)
{
VLOG
(
1
)
<<
"Set GPU configurations, gpu_perf_hint: "
<<
gpu_perf_hint
<<
", gpu_priority_hint: "
<<
gpu_priority_hint
;
OpenCLRuntime
::
Configure
(
gpu_perf_hint
,
gpu_priority_hint
);
}
MaceStatus
SetOpenMPThreadPolicy
(
int
num_threads_hint
,
CPUAffinityPolicy
policy
)
{
VLOG
(
1
)
<<
"Set OpenMP threads number hint: "
<<
num_threads_hint
<<
", affinity policy: "
<<
policy
;
return
SetOpenMPThreadsAndAffinityPolicy
(
num_threads_hint
,
policy
);
}
MaceStatus
SetOpenMPThreadAffinity
(
int
num_threads
,
const
std
::
vector
<
int
>
&
cpu_ids
)
{
return
SetOpenMPThreadsAndAffinityCPUs
(
num_threads
,
cpu_ids
);
}
MaceStatus
GetBigLittleCoreIDs
(
std
::
vector
<
int
>
*
big_core_ids
,
std
::
vector
<
int
>
*
little_core_ids
)
{
return
GetCPUBigLittleCoreIDs
(
big_core_ids
,
little_core_ids
);
}
};
// namespace mace
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录