Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
2d00e658
P
Paddle
项目概览
机器未来
/
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看板
未验证
提交
2d00e658
编写于
9月 28, 2018
作者:
D
dzhwinter
提交者:
GitHub
9月 28, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
namespace issue (#13543)
* flags * "follow comment"
上级
a5b20a9e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
12 deletion
+29
-12
paddle/fluid/platform/dynload/cublas.h
paddle/fluid/platform/dynload/cublas.h
+1
-1
paddle/fluid/platform/dynload/cudnn.h
paddle/fluid/platform/dynload/cudnn.h
+10
-7
paddle/fluid/platform/dynload/curand.h
paddle/fluid/platform/dynload/curand.h
+1
-1
paddle/fluid/platform/dynload/dynamic_loader.cc
paddle/fluid/platform/dynload/dynamic_loader.cc
+17
-3
未找到文件。
paddle/fluid/platform/dynload/cublas.h
浏览文件 @
2d00e658
...
@@ -55,7 +55,7 @@ extern void *cublas_dso_handle;
...
@@ -55,7 +55,7 @@ extern void *cublas_dso_handle;
struct DynLoad__##__name { \
struct DynLoad__##__name { \
template <typename... Args> \
template <typename... Args> \
inline cublasStatus_t operator()(Args... args) { \
inline cublasStatus_t operator()(Args... args) { \
return
__name(args...);
\
return
::__name(args...);
\
} \
} \
}; \
}; \
extern DynLoad__##__name __name
extern DynLoad__##__name __name
...
...
paddle/fluid/platform/dynload/cudnn.h
浏览文件 @
2d00e658
...
@@ -13,6 +13,9 @@ See the License for the specific language governing permissions and
...
@@ -13,6 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License. */
limitations under the License. */
#pragma once
#pragma once
#define GLOG_NO_ABBREVIATED_SEVERITIES
#define GOOGLE_GLOG_DLL_DECL
#include <glog/logging.h>
#include <cudnn.h>
#include <cudnn.h>
#include <mutex> // NOLINT
#include <mutex> // NOLINT
...
@@ -47,13 +50,13 @@ extern void EnforceCUDNNLoaded(const char* fn_name);
...
@@ -47,13 +50,13 @@ extern void EnforceCUDNNLoaded(const char* fn_name);
#else
#else
#define DECLARE_DYNAMIC_LOAD_CUDNN_WRAP(__name)
\
#define DECLARE_DYNAMIC_LOAD_CUDNN_WRAP(__name) \
struct DynLoad__##__name {
\
struct DynLoad__##__name { \
template <typename... Args>
\
template <typename... Args> \
auto operator()(Args... args) -> decltype(__name(args...)
) { \
inline cudnnStatus_t operator()(Args... args
) { \
return
__name(args...);
\
return
::__name(args...);
\
}
\
} \
};
\
}; \
extern DynLoad__##__name __name
extern DynLoad__##__name __name
#endif
#endif
...
...
paddle/fluid/platform/dynload/curand.h
浏览文件 @
2d00e658
...
@@ -44,7 +44,7 @@ extern void *curand_dso_handle;
...
@@ -44,7 +44,7 @@ extern void *curand_dso_handle;
struct DynLoad__##__name { \
struct DynLoad__##__name { \
template <typename... Args> \
template <typename... Args> \
curandStatus_t operator()(Args... args) { \
curandStatus_t operator()(Args... args) { \
return
__name(args...);
\
return
::__name(args...);
\
} \
} \
}; \
}; \
extern DynLoad__##__name __name
extern DynLoad__##__name __name
...
...
paddle/fluid/platform/dynload/dynamic_loader.cc
浏览文件 @
2d00e658
...
@@ -107,7 +107,11 @@ static inline void* GetDsoHandleFromDefaultPath(const std::string& dso_path,
...
@@ -107,7 +107,11 @@ static inline void* GetDsoHandleFromDefaultPath(const std::string& dso_path,
static
inline
void
*
GetDsoHandleFromSearchPath
(
const
std
::
string
&
search_root
,
static
inline
void
*
GetDsoHandleFromSearchPath
(
const
std
::
string
&
search_root
,
const
std
::
string
&
dso_name
,
const
std
::
string
&
dso_name
,
bool
throw_on_error
=
true
)
{
bool
throw_on_error
=
true
)
{
#if !defined(_WIN32)
int
dynload_flags
=
RTLD_LAZY
|
RTLD_LOCAL
;
int
dynload_flags
=
RTLD_LAZY
|
RTLD_LOCAL
;
#else
int
dynload_flags
=
0
;
#endif // !_WIN32
void
*
dso_handle
=
nullptr
;
void
*
dso_handle
=
nullptr
;
std
::
string
dlPath
=
dso_name
;
std
::
string
dlPath
=
dso_name
;
...
@@ -117,10 +121,15 @@ static inline void* GetDsoHandleFromSearchPath(const std::string& search_root,
...
@@ -117,10 +121,15 @@ static inline void* GetDsoHandleFromSearchPath(const std::string& search_root,
// search xxx.so from custom path
// search xxx.so from custom path
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 !defined(_WIN32)
auto
errorno
=
dlerror
();
#else
auto
errorno
=
GetLastError
();
#endif // !_WIN32
// 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 dynamic library: "
<<
dlPath
<<
" ("
LOG
(
WARNING
)
<<
"Failed to find dynamic library: "
<<
dlPath
<<
" ("
<<
dlerror
()
<<
")"
;
<<
errorno
<<
")"
;
if
(
dlPath
.
find
(
"nccl"
)
!=
std
::
string
::
npos
)
{
if
(
dlPath
.
find
(
"nccl"
)
!=
std
::
string
::
npos
)
{
std
::
cout
std
::
cout
<<
"You may need to install 'nccl2' from NVIDIA official website: "
<<
"You may need to install 'nccl2' from NVIDIA official website: "
...
@@ -139,10 +148,15 @@ static inline void* GetDsoHandleFromSearchPath(const std::string& search_root,
...
@@ -139,10 +148,15 @@ static inline void* GetDsoHandleFromSearchPath(const std::string& search_root,
"export LD_LIBRARY_PATH=...
\n
Note: After Mac OS 10.11, "
"export LD_LIBRARY_PATH=...
\n
Note: After Mac OS 10.11, "
"using the DYLD_LIBRARY_PATH is impossible unless System "
"using the DYLD_LIBRARY_PATH is impossible unless System "
"Integrity Protection (SIP) is disabled."
;
"Integrity Protection (SIP) is disabled."
;
#if !defined(_WIN32)
auto
errorno
=
dlerror
();
#else
auto
errorno
=
GetLastError
();
#endif // !_WIN32
if
(
throw_on_error
)
{
if
(
throw_on_error
)
{
PADDLE_ENFORCE
(
nullptr
!=
dso_handle
,
error_msg
,
dlPath
,
dlerror
()
);
PADDLE_ENFORCE
(
nullptr
!=
dso_handle
,
error_msg
,
dlPath
,
errorno
);
}
else
if
(
nullptr
==
dso_handle
)
{
}
else
if
(
nullptr
==
dso_handle
)
{
LOG
(
WARNING
)
<<
string
::
Sprintf
(
error_msg
,
dlPath
,
dlerror
()
);
LOG
(
WARNING
)
<<
string
::
Sprintf
(
error_msg
,
dlPath
,
errorno
);
}
}
return
dso_handle
;
return
dso_handle
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录