Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
e1999538
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e1999538
编写于
9月 14, 2018
作者:
D
dzhwinter
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
debug the device context
上级
372caf40
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
13 addition
and
5 deletion
+13
-5
cmake/external/gflags.cmake
cmake/external/gflags.cmake
+4
-3
paddle/fluid/inference/api/api_impl.cc
paddle/fluid/inference/api/api_impl.cc
+4
-2
paddle/fluid/platform/init.cc
paddle/fluid/platform/init.cc
+5
-0
未找到文件。
cmake/external/gflags.cmake
浏览文件 @
e1999538
...
@@ -47,6 +47,10 @@ ExternalProject_Add(
...
@@ -47,6 +47,10 @@ ExternalProject_Add(
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=
${
THIRD_PARTY_BUILD_TYPE
}
-DCMAKE_BUILD_TYPE:STRING=
${
THIRD_PARTY_BUILD_TYPE
}
)
)
ADD_LIBRARY
(
gflags STATIC IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET gflags PROPERTY IMPORTED_LOCATION
${
GFLAGS_LIBRARIES
}
)
ADD_DEPENDENCIES
(
gflags extern_gflags
)
IF
(
WIN32
)
IF
(
WIN32
)
IF
(
NOT EXISTS
"
${
GFLAGS_INSTALL_DIR
}
/lib/libgflags.lib"
)
IF
(
NOT EXISTS
"
${
GFLAGS_INSTALL_DIR
}
/lib/libgflags.lib"
)
add_custom_command
(
TARGET extern_gflags POST_BUILD
add_custom_command
(
TARGET extern_gflags POST_BUILD
...
@@ -54,9 +58,6 @@ IF(WIN32)
...
@@ -54,9 +58,6 @@ IF(WIN32)
)
)
ENDIF
()
ENDIF
()
ENDIF
(
WIN32
)
ENDIF
(
WIN32
)
ADD_LIBRARY
(
gflags STATIC IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET gflags PROPERTY IMPORTED_LOCATION
${
GFLAGS_LIBRARIES
}
)
ADD_DEPENDENCIES
(
gflags extern_gflags
)
LIST
(
APPEND external_project_dependencies gflags
)
LIST
(
APPEND external_project_dependencies gflags
)
...
...
paddle/fluid/inference/api/api_impl.cc
浏览文件 @
e1999538
...
@@ -61,7 +61,7 @@ bool NativePaddlePredictor::Init(
...
@@ -61,7 +61,7 @@ bool NativePaddlePredictor::Init(
platform
::
EnableProfiler
(
tracking_device
);
platform
::
EnableProfiler
(
tracking_device
);
}
}
#endif
#endif
VLOG
(
3
)
<<
"before Place"
;
if
(
config_
.
use_gpu
)
{
if
(
config_
.
use_gpu
)
{
place_
=
paddle
::
platform
::
CUDAPlace
(
config_
.
device
);
place_
=
paddle
::
platform
::
CUDAPlace
(
config_
.
device
);
}
else
{
}
else
{
...
@@ -73,10 +73,12 @@ bool NativePaddlePredictor::Init(
...
@@ -73,10 +73,12 @@ bool NativePaddlePredictor::Init(
sub_scope_
=
&
(
parent_scope
->
NewScope
());
sub_scope_
=
&
(
parent_scope
->
NewScope
());
PADDLE_ENFORCE_NOT_NULL
(
sub_scope_
,
"create sub scope fail"
);
PADDLE_ENFORCE_NOT_NULL
(
sub_scope_
,
"create sub scope fail"
);
}
else
{
}
else
{
VLOG
(
3
)
<<
"Before InitDevices"
;
paddle
::
framework
::
InitDevices
(
false
);
paddle
::
framework
::
InitDevices
(
false
);
VLOG
(
3
)
<<
"after InitDevices"
;
scope_
.
reset
(
new
paddle
::
framework
::
Scope
());
scope_
.
reset
(
new
paddle
::
framework
::
Scope
());
}
}
VLOG
(
3
)
<<
"after scope"
VLOG
(
3
)
<<
"after scope"
;
executor_
.
reset
(
new
paddle
::
framework
::
Executor
(
place_
));
executor_
.
reset
(
new
paddle
::
framework
::
Executor
(
place_
));
VLOG
(
3
)
<<
"executor"
;
VLOG
(
3
)
<<
"executor"
;
// Initialize the inference program
// Initialize the inference program
...
...
paddle/fluid/platform/init.cc
浏览文件 @
e1999538
...
@@ -94,7 +94,9 @@ void InitDevices(bool init_p2p, const std::vector<int> devices) {
...
@@ -94,7 +94,9 @@ void InitDevices(bool init_p2p, const std::vector<int> devices) {
int
count
=
0
;
int
count
=
0
;
#ifdef PADDLE_WITH_CUDA
#ifdef PADDLE_WITH_CUDA
try
{
try
{
VLOG
(
3
)
<<
"get cuda count"
;
count
=
platform
::
GetCUDADeviceCount
();
count
=
platform
::
GetCUDADeviceCount
();
VLOG
(
3
)
<<
"get cuda pass"
;
}
catch
(
const
std
::
exception
&
exp
)
{
}
catch
(
const
std
::
exception
&
exp
)
{
LOG
(
WARNING
)
<<
"Compiled with WITH_GPU, but no GPU found in runtime."
;
LOG
(
WARNING
)
<<
"Compiled with WITH_GPU, but no GPU found in runtime."
;
}
}
...
@@ -107,11 +109,14 @@ void InitDevices(bool init_p2p, const std::vector<int> devices) {
...
@@ -107,11 +109,14 @@ void InitDevices(bool init_p2p, const std::vector<int> devices) {
}
}
places
.
emplace_back
(
platform
::
CUDAPlace
(
devices
[
i
]));
places
.
emplace_back
(
platform
::
CUDAPlace
(
devices
[
i
]));
}
}
VLOG
(
3
)
<<
"before p2p"
;
if
(
init_p2p
)
{
if
(
init_p2p
)
{
InitP2P
(
devices
);
InitP2P
(
devices
);
}
}
VLOG
(
3
)
<<
"p2p pass"
;
places
.
emplace_back
(
platform
::
CPUPlace
());
places
.
emplace_back
(
platform
::
CPUPlace
());
platform
::
DeviceContextPool
::
Init
(
places
);
platform
::
DeviceContextPool
::
Init
(
places
);
VLOG
(
3
)
<<
"init pass"
;
#ifndef PADDLE_WITH_MKLDNN
#ifndef PADDLE_WITH_MKLDNN
platform
::
SetNumThreads
(
FLAGS_paddle_num_threads
);
platform
::
SetNumThreads
(
FLAGS_paddle_num_threads
);
#endif
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录