Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
Mace
提交
455b60c5
Mace
项目概览
慢慢CG
/
Mace
与 Fork 源项目一致
Fork自
Xiaomi / Mace
通知
1
Star
0
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看板
提交
455b60c5
编写于
6月 05, 2018
作者:
L
liuqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix host runtime bug for calling SetOpenCLBinaryPaths.
上级
2b1defc7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
26 addition
and
25 deletion
+26
-25
mace/benchmark/benchmark_model.cc
mace/benchmark/benchmark_model.cc
+3
-5
mace/core/file_storage.cc
mace/core/file_storage.cc
+11
-11
mace/core/runtime/opencl/opencl_runtime.cc
mace/core/runtime/opencl/opencl_runtime.cc
+9
-4
mace/tools/validation/mace_run.cc
mace/tools/validation/mace_run.cc
+3
-5
未找到文件。
mace/benchmark/benchmark_model.cc
浏览文件 @
455b60c5
...
@@ -261,6 +261,9 @@ int Main(int argc, char **argv) {
...
@@ -261,6 +261,9 @@ int Main(int argc, char **argv) {
mace
::
SetGPUHints
(
mace
::
SetGPUHints
(
static_cast
<
GPUPerfHint
>
(
FLAGS_gpu_perf_hint
),
static_cast
<
GPUPerfHint
>
(
FLAGS_gpu_perf_hint
),
static_cast
<
GPUPriorityHint
>
(
FLAGS_gpu_priority_hint
));
static_cast
<
GPUPriorityHint
>
(
FLAGS_gpu_priority_hint
));
std
::
vector
<
std
::
string
>
opencl_binary_paths
=
{
FLAGS_opencl_binary_file
};
mace
::
SetOpenCLBinaryPaths
(
opencl_binary_paths
);
}
}
#endif // MACE_ENABLE_OPENCL
#endif // MACE_ENABLE_OPENCL
...
@@ -273,11 +276,6 @@ int Main(int argc, char **argv) {
...
@@ -273,11 +276,6 @@ int Main(int argc, char **argv) {
new
FileStorageFactory
(
kernel_file_path
));
new
FileStorageFactory
(
kernel_file_path
));
SetKVStorageFactory
(
storage_factory
);
SetKVStorageFactory
(
storage_factory
);
if
(
device_type
==
DeviceType
::
GPU
)
{
std
::
vector
<
std
::
string
>
opencl_binary_paths
=
{
FLAGS_opencl_binary_file
};
mace
::
SetOpenCLBinaryPaths
(
opencl_binary_paths
);
}
// Create Engine
// Create Engine
std
::
shared_ptr
<
mace
::
MaceEngine
>
engine
;
std
::
shared_ptr
<
mace
::
MaceEngine
>
engine
;
MaceStatus
create_engine_status
;
MaceStatus
create_engine_status
;
...
...
mace/core/file_storage.cc
浏览文件 @
455b60c5
...
@@ -68,7 +68,7 @@ int FileStorage::Load() {
...
@@ -68,7 +68,7 @@ int FileStorage::Load() {
return
0
;
return
0
;
}
else
{
}
else
{
LOG
(
WARNING
)
<<
"Stat file "
<<
file_path_
LOG
(
WARNING
)
<<
"Stat file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -81,7 +81,7 @@ int FileStorage::Load() {
...
@@ -81,7 +81,7 @@ int FileStorage::Load() {
return
0
;
return
0
;
}
else
{
}
else
{
LOG
(
WARNING
)
<<
"open file "
<<
file_path_
LOG
(
WARNING
)
<<
"open file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
return
-
1
;
return
-
1
;
}
}
}
}
...
@@ -92,12 +92,12 @@ int FileStorage::Load() {
...
@@ -92,12 +92,12 @@ int FileStorage::Load() {
int
res
=
0
;
int
res
=
0
;
if
(
file_data
==
MAP_FAILED
)
{
if
(
file_data
==
MAP_FAILED
)
{
LOG
(
WARNING
)
<<
"mmap file "
<<
file_path_
LOG
(
WARNING
)
<<
"mmap file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
res
=
close
(
fd
);
res
=
close
(
fd
);
if
(
res
!=
0
)
{
if
(
res
!=
0
)
{
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
}
}
return
-
1
;
return
-
1
;
}
}
...
@@ -130,18 +130,18 @@ int FileStorage::Load() {
...
@@ -130,18 +130,18 @@ int FileStorage::Load() {
res
=
munmap
(
file_data
,
file_size
);
res
=
munmap
(
file_data
,
file_size
);
if
(
res
!=
0
)
{
if
(
res
!=
0
)
{
LOG
(
WARNING
)
<<
"munmap file "
<<
file_path_
LOG
(
WARNING
)
<<
"munmap file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
res
=
close
(
fd
);
res
=
close
(
fd
);
if
(
res
!=
0
)
{
if
(
res
!=
0
)
{
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
}
}
return
-
1
;
return
-
1
;
}
}
res
=
close
(
fd
);
res
=
close
(
fd
);
if
(
res
!=
0
)
{
if
(
res
!=
0
)
{
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
return
-
1
;
return
-
1
;
}
}
return
0
;
return
0
;
...
@@ -169,7 +169,7 @@ int FileStorage::Flush() {
...
@@ -169,7 +169,7 @@ int FileStorage::Flush() {
int
fd
=
open
(
file_path_
.
c_str
(),
O_WRONLY
|
O_CREAT
,
0600
);
int
fd
=
open
(
file_path_
.
c_str
(),
O_WRONLY
|
O_CREAT
,
0600
);
if
(
fd
<
0
)
{
if
(
fd
<
0
)
{
LOG
(
WARNING
)
<<
"open file "
<<
file_path_
LOG
(
WARNING
)
<<
"open file "
<<
file_path_
<<
" failed, error code:
"
<<
errno
;
<<
" failed, error code:
"
<<
strerror
(
errno
)
;
return
-
1
;
return
-
1
;
}
}
...
@@ -208,11 +208,11 @@ int FileStorage::Flush() {
...
@@ -208,11 +208,11 @@ int FileStorage::Flush() {
res
=
write
(
fd
,
buffer_ptr
,
buffer_size
);
res
=
write
(
fd
,
buffer_ptr
,
buffer_size
);
if
(
res
==
-
1
)
{
if
(
res
==
-
1
)
{
LOG
(
WARNING
)
<<
"write file "
<<
file_path_
LOG
(
WARNING
)
<<
"write file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
res
=
close
(
fd
);
res
=
close
(
fd
);
if
(
res
!=
0
)
{
if
(
res
!=
0
)
{
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
}
}
return
-
1
;
return
-
1
;
}
}
...
@@ -223,7 +223,7 @@ int FileStorage::Flush() {
...
@@ -223,7 +223,7 @@ int FileStorage::Flush() {
res
=
close
(
fd
);
res
=
close
(
fd
);
if
(
res
!=
0
)
{
if
(
res
!=
0
)
{
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
LOG
(
WARNING
)
<<
"close file "
<<
file_path_
<<
" failed, error code: "
<<
errno
;
<<
" failed, error code: "
<<
strerror
(
errno
)
;
return
-
1
;
return
-
1
;
}
}
data_changed_
=
false
;
data_changed_
=
false
;
...
...
mace/core/runtime/opencl/opencl_runtime.cc
浏览文件 @
455b60c5
...
@@ -409,7 +409,9 @@ OpenCLRuntime::OpenCLRuntime():
...
@@ -409,7 +409,9 @@ OpenCLRuntime::OpenCLRuntime():
kStorageFactory
->
CreateStorage
(
kPrecompiledProgramFileName
);
kStorageFactory
->
CreateStorage
(
kPrecompiledProgramFileName
);
if
(
cache_storage_
->
Load
()
!=
0
)
{
if
(
cache_storage_
->
Load
()
!=
0
)
{
LOG
(
FATAL
)
<<
"Load OpenCL cached compiled kernel file failed"
;
LOG
(
WARNING
)
<<
"Load OpenCL cached compiled kernel file failed. "
<<
"Please make sure the storage directory exist "
<<
"and you have Write&Read permission"
;
}
}
auto
platform_info_array
=
auto
platform_info_array
=
this
->
cache_storage_
->
Find
(
kOpenCLPlatformInfoKey
);
this
->
cache_storage_
->
Find
(
kOpenCLPlatformInfoKey
);
...
@@ -428,7 +430,9 @@ OpenCLRuntime::OpenCLRuntime():
...
@@ -428,7 +430,9 @@ OpenCLRuntime::OpenCLRuntime():
precompiled_binary_storage_
.
reset
(
precompiled_binary_storage_
.
reset
(
new
FileStorage
(
OpenCLRuntime
::
kPrecompiledBinaryPath
));
new
FileStorage
(
OpenCLRuntime
::
kPrecompiledBinaryPath
));
if
(
precompiled_binary_storage_
->
Load
()
!=
0
)
{
if
(
precompiled_binary_storage_
->
Load
()
!=
0
)
{
LOG
(
FATAL
)
<<
"Load OpenCL precompiled kernel file failed"
;
LOG
(
WARNING
)
<<
"Load OpenCL precompiled kernel file failed. "
<<
"Please make sure the storage directory exist "
<<
"and you have Write&Read permission"
;
}
}
auto
platform_info_array
=
auto
platform_info_array
=
...
@@ -657,8 +661,9 @@ void OpenCLRuntime::SaveBuiltCLProgram() {
...
@@ -657,8 +661,9 @@ void OpenCLRuntime::SaveBuiltCLProgram() {
std
::
vector
<
unsigned
char
>
(
platform_info_
.
begin
(),
std
::
vector
<
unsigned
char
>
(
platform_info_
.
begin
(),
platform_info_
.
end
()));
platform_info_
.
end
()));
if
(
cache_storage_
->
Flush
()
!=
0
)
{
if
(
cache_storage_
->
Flush
()
!=
0
)
{
LOG
(
FATAL
)
<<
"Store OPENCL compiled kernel to file failed."
LOG
(
FATAL
)
<<
"Store OPENCL compiled kernel to file failed. "
" Please Make sure the storage directory exist."
;
<<
"Please make sure the storage directory exist "
<<
"and you have Write&Read permission"
;
}
}
}
}
}
}
...
...
mace/tools/validation/mace_run.cc
浏览文件 @
455b60c5
...
@@ -202,6 +202,9 @@ bool RunModel(const std::string &model_name,
...
@@ -202,6 +202,9 @@ bool RunModel(const std::string &model_name,
mace
::
SetGPUHints
(
mace
::
SetGPUHints
(
static_cast
<
GPUPerfHint
>
(
FLAGS_gpu_perf_hint
),
static_cast
<
GPUPerfHint
>
(
FLAGS_gpu_perf_hint
),
static_cast
<
GPUPriorityHint
>
(
FLAGS_gpu_priority_hint
));
static_cast
<
GPUPriorityHint
>
(
FLAGS_gpu_priority_hint
));
std
::
vector
<
std
::
string
>
opencl_binary_paths
=
{
FLAGS_opencl_binary_file
};
mace
::
SetOpenCLBinaryPaths
(
opencl_binary_paths
);
}
}
#endif // MACE_ENABLE_OPENCL
#endif // MACE_ENABLE_OPENCL
...
@@ -214,11 +217,6 @@ bool RunModel(const std::string &model_name,
...
@@ -214,11 +217,6 @@ bool RunModel(const std::string &model_name,
new
FileStorageFactory
(
kernel_file_path
));
new
FileStorageFactory
(
kernel_file_path
));
SetKVStorageFactory
(
storage_factory
);
SetKVStorageFactory
(
storage_factory
);
if
(
device_type
==
DeviceType
::
GPU
)
{
std
::
vector
<
std
::
string
>
opencl_binary_paths
=
{
FLAGS_opencl_binary_file
};
mace
::
SetOpenCLBinaryPaths
(
opencl_binary_paths
);
}
std
::
vector
<
unsigned
char
>
model_pb_data
;
std
::
vector
<
unsigned
char
>
model_pb_data
;
if
(
FLAGS_model_file
!=
""
)
{
if
(
FLAGS_model_file
!=
""
)
{
if
(
!
mace
::
ReadBinaryFile
(
&
model_pb_data
,
FLAGS_model_file
))
{
if
(
!
mace
::
ReadBinaryFile
(
&
model_pb_data
,
FLAGS_model_file
))
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录