Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
3f8d5416
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3f8d5416
编写于
11月 22, 2016
作者:
Y
Yiqun Liu
提交者:
GitHub
11月 22, 2016
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #553 from PaddlePaddle/gangliao-patch-1
Fix a pointer comparison bug in hl_dso_loader.cc
上级
5fdaa966
049f9d3a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
20 deletion
+19
-20
paddle/cuda/src/hl_dso_loader.cc
paddle/cuda/src/hl_dso_loader.cc
+19
-20
未找到文件。
paddle/cuda/src/hl_dso_loader.cc
浏览文件 @
3f8d5416
...
@@ -19,7 +19,7 @@ limitations under the License. */
...
@@ -19,7 +19,7 @@ limitations under the License. */
P_DEFINE_string
(
cudnn_dir
,
""
,
P_DEFINE_string
(
cudnn_dir
,
""
,
"Specify path for loading libcudnn.so. For instance, "
"Specify path for loading libcudnn.so. For instance, "
"/usr/local/cudnn/lib
64
. If empty [default], dlopen "
"/usr/local/cudnn/lib. If empty [default], dlopen "
"will search cudnn from LD_LIBRARY_PATH"
);
"will search cudnn from LD_LIBRARY_PATH"
);
P_DEFINE_string
(
cuda_dir
,
""
,
P_DEFINE_string
(
cuda_dir
,
""
,
...
@@ -31,24 +31,23 @@ P_DEFINE_string(cuda_dir, "",
...
@@ -31,24 +31,23 @@ P_DEFINE_string(cuda_dir, "",
static
inline
std
::
string
join
(
const
std
::
string
&
part1
,
static
inline
std
::
string
join
(
const
std
::
string
&
part1
,
const
std
::
string
&
part2
)
{
const
std
::
string
&
part2
)
{
// directory separator
// directory separator
const
char
sep
=
'/'
;
const
char
sep
=
'/'
;
if
(
!
part2
.
empty
()
&&
part2
.
front
()
==
sep
)
{
if
(
!
part2
.
empty
()
&&
part2
.
front
()
==
sep
)
{
return
part2
;
return
part2
;
}
}
std
::
string
ret
;
std
::
string
ret
;
ret
.
reserve
(
part1
.
size
()
+
part2
.
size
()
+
1
);
ret
.
reserve
(
part1
.
size
()
+
part2
.
size
()
+
1
);
ret
=
part1
;
ret
=
part1
;
if
(
!
ret
.
empty
()
&&
ret
.
back
()
!=
sep
)
{
if
(
!
ret
.
empty
()
&&
ret
.
back
()
!=
sep
)
{
ret
+=
sep
;
ret
+=
sep
;
}
}
ret
+=
part2
;
ret
+=
part2
;
return
ret
;
return
ret
;
}
}
static
inline
void
GetDsoHandleFromDefaultPath
(
static
inline
void
GetDsoHandleFromDefaultPath
(
std
::
string
&
dso_path
,
void
**
dso_handle
,
int
dynload_flags
)
{
std
::
string
&
dso_path
,
void
**
dso_handle
,
int
dynload_flags
)
{
VLOG
(
3
)
<<
"Try to find cuda library: "
<<
dso_path
VLOG
(
3
)
<<
"Try to find cuda library: "
<<
dso_path
<<
" from default system path."
;
<<
" from default system path."
;
// default search from LD_LIBRARY_PATH/DYLD_LIBRARY_PATH
// default search from LD_LIBRARY_PATH/DYLD_LIBRARY_PATH
...
@@ -74,9 +73,9 @@ static inline void GetDsoHandleFromDefaultPath(
...
@@ -74,9 +73,9 @@ static inline void GetDsoHandleFromDefaultPath(
}
}
static
inline
void
GetDsoHandleFromSearchPath
(
static
inline
void
GetDsoHandleFromSearchPath
(
const
std
::
string
&
search_root
,
const
std
::
string
&
search_root
,
const
std
::
string
&
dso_name
,
const
std
::
string
&
dso_name
,
void
**
dso_handle
)
{
void
**
dso_handle
)
{
int
dynload_flags
=
RTLD_LAZY
|
RTLD_LOCAL
;
int
dynload_flags
=
RTLD_LAZY
|
RTLD_LOCAL
;
*
dso_handle
=
nullptr
;
*
dso_handle
=
nullptr
;
...
@@ -88,7 +87,7 @@ static inline void GetDsoHandleFromSearchPath(
...
@@ -88,7 +87,7 @@ static inline void GetDsoHandleFromSearchPath(
dlPath
=
join
(
search_root
,
dso_name
);
dlPath
=
join
(
search_root
,
dso_name
);
*
dso_handle
=
dlopen
(
dlPath
.
c_str
(),
dynload_flags
);
*
dso_handle
=
dlopen
(
dlPath
.
c_str
(),
dynload_flags
);
// if not found, search from default path
// if not found, search from default path
if
(
nullptr
==
dso_handle
)
{
if
(
nullptr
==
*
dso_handle
)
{
LOG
(
WARNING
)
<<
"Failed to find cuda library: "
<<
dlPath
;
LOG
(
WARNING
)
<<
"Failed to find cuda library: "
<<
dlPath
;
dlPath
=
dso_name
;
dlPath
=
dso_name
;
GetDsoHandleFromDefaultPath
(
dlPath
,
dso_handle
,
dynload_flags
);
GetDsoHandleFromDefaultPath
(
dlPath
,
dso_handle
,
dynload_flags
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录