Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
3567ea6d
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3567ea6d
编写于
7月 04, 2017
作者:
Q
qijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move to dynload directory
上级
9eeabe98
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
46 addition
and
45 deletion
+46
-45
paddle/platform/CMakeLists.txt
paddle/platform/CMakeLists.txt
+2
-2
paddle/platform/dynload/CMakeLists.txt
paddle/platform/dynload/CMakeLists.txt
+1
-0
paddle/platform/dynload/cublas.h
paddle/platform/dynload/cublas.h
+13
-13
paddle/platform/dynload/cudnn.h
paddle/platform/dynload/cudnn.h
+13
-13
paddle/platform/dynload/curand.h
paddle/platform/dynload/curand.h
+13
-13
paddle/platform/dynload/dynamic_loader.cc
paddle/platform/dynload/dynamic_loader.cc
+2
-2
paddle/platform/dynload/dynamic_loader.h
paddle/platform/dynload/dynamic_loader.h
+2
-2
未找到文件。
paddle/platform/CMakeLists.txt
浏览文件 @
3567ea6d
add_subdirectory
(
dynload
)
nv_test
(
cuda_test SRCS cuda_test.cu
)
nv_test
(
cuda_test SRCS cuda_test.cu
)
cc_library
(
place SRCS place.cc
)
cc_library
(
place SRCS place.cc
)
cc_test
(
place_test SRCS place_test.cc DEPS place glog gflags
)
cc_test
(
place_test SRCS place_test.cc DEPS place glog gflags
)
cc_library
(
dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags
)
paddle/platform/dynload/CMakeLists.txt
0 → 100644
浏览文件 @
3567ea6d
cc_library
(
dynamic_loader SRCS dynamic_loader.cc DEPS glog gflags
)
paddle/platform/cublas.h
→
paddle/platform/
dynload/
cublas.h
浏览文件 @
3567ea6d
...
@@ -19,7 +19,7 @@ limitations under the License. */
...
@@ -19,7 +19,7 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
platform
{
namespace
platform
{
namespace
dyload
{
namespace
dy
n
load
{
std
::
once_flag
cublas_dso_flag
;
std
::
once_flag
cublas_dso_flag
;
void
*
cublas_dso_handle
=
nullptr
;
void
*
cublas_dso_handle
=
nullptr
;
...
@@ -32,17 +32,17 @@ void *cublas_dso_handle = nullptr;
...
@@ -32,17 +32,17 @@ void *cublas_dso_handle = nullptr;
* note: default dynamic linked libs
* note: default dynamic linked libs
*/
*/
#ifdef PADDLE_USE_DSO
#ifdef PADDLE_USE_DSO
#define DYNAMIC_LOAD_CUBLAS_WRAP(__name) \
#define DYNAMIC_LOAD_CUBLAS_WRAP(__name)
\
struct DynLoad__##__name { \
struct DynLoad__##__name {
\
template <typename... Args> \
template <typename... Args>
\
cublasStatus_t operator()(Args... args) { \
cublasStatus_t operator()(Args... args) {
\
typedef cublasStatus_t (*cublasFunc)(Args...); \
typedef cublasStatus_t (*cublasFunc)(Args...);
\
std::call_once(cublas_dso_flag, \
std::call_once(cublas_dso_flag,
\
paddle::platform::dyload::GetCublasDsoHandle, \
paddle::platform::dy
n
load::GetCublasDsoHandle, \
&cublas_dso_handle); \
&cublas_dso_handle);
\
void *p_##__name = dlsym(cublas_dso_handle, #__name); \
void *p_##__name = dlsym(cublas_dso_handle, #__name);
\
return reinterpret_cast<cublasFunc>(p_##__name)(args...); \
return reinterpret_cast<cublasFunc>(p_##__name)(args...);
\
} \
}
\
} __name; // struct DynLoad__##__name
} __name; // struct DynLoad__##__name
#else
#else
#define DYNAMIC_LOAD_CUBLAS_WRAP(__name) \
#define DYNAMIC_LOAD_CUBLAS_WRAP(__name) \
...
@@ -99,6 +99,6 @@ CUBLAS_BLAS_ROUTINE_EACH(DYNAMIC_LOAD_CUBLAS_V2_WRAP)
...
@@ -99,6 +99,6 @@ CUBLAS_BLAS_ROUTINE_EACH(DYNAMIC_LOAD_CUBLAS_V2_WRAP)
#define CUBLAS_GETRF paddle::platform::dynload::cublasDgetrfBatched
#define CUBLAS_GETRF paddle::platform::dynload::cublasDgetrfBatched
#define CUBLAS_GETRI paddle::platform::dynload::cublasDgetriBatched
#define CUBLAS_GETRI paddle::platform::dynload::cublasDgetriBatched
#endif
#endif
}
// namespace dyload
}
// namespace dy
n
load
}
// namespace platform
}
// namespace platform
}
// namespace paddle
}
// namespace paddle
paddle/platform/cudnn.h
→
paddle/platform/
dynload/
cudnn.h
浏览文件 @
3567ea6d
...
@@ -19,24 +19,24 @@ limitations under the License. */
...
@@ -19,24 +19,24 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
platform
{
namespace
platform
{
namespace
dyload
{
namespace
dy
n
load
{
std
::
once_flag
cudnn_dso_flag
;
std
::
once_flag
cudnn_dso_flag
;
void
*
cudnn_dso_handle
=
nullptr
;
void
*
cudnn_dso_handle
=
nullptr
;
#ifdef PADDLE_USE_DSO
#ifdef PADDLE_USE_DSO
#define DYNAMIC_LOAD_CUDNN_WRAP(__name) \
#define DYNAMIC_LOAD_CUDNN_WRAP(__name)
\
struct DynLoad__##__name { \
struct DynLoad__##__name {
\
template <typename... Args> \
template <typename... Args>
\
auto operator()(Args... args) -> decltype(__name(args...)) { \
auto operator()(Args... args) -> decltype(__name(args...)) {
\
using cudnn_func = decltype(__name(args...)) (*)(Args...); \
using cudnn_func = decltype(__name(args...)) (*)(Args...);
\
std::call_once(cudnn_dso_flag, \
std::call_once(cudnn_dso_flag,
\
paddle::platform::dyload::GetCudnnDsoHandle, \
paddle::platform::dy
n
load::GetCudnnDsoHandle, \
&cudnn_dso_handle); \
&cudnn_dso_handle);
\
void* p_##__name = dlsym(cudnn_dso_handle, #__name); \
void* p_##__name = dlsym(cudnn_dso_handle, #__name);
\
return reinterpret_cast<cudnn_func>(p_##__name)(args...); \
return reinterpret_cast<cudnn_func>(p_##__name)(args...);
\
} \
}
\
} __name;
/* struct DynLoad__##__name */
} __name;
/* struct DynLoad__##__name */
#else
#else
...
@@ -129,6 +129,6 @@ CUDNN_DNN_ROUTINE_EACH_R5(DYNAMIC_LOAD_CUDNN_WRAP)
...
@@ -129,6 +129,6 @@ CUDNN_DNN_ROUTINE_EACH_R5(DYNAMIC_LOAD_CUDNN_WRAP)
#undef CUDNN_DNN_ROUTINE_EACH
#undef CUDNN_DNN_ROUTINE_EACH
// clang-format on
// clang-format on
}
// namespace dyload
}
// namespace dy
n
load
}
// namespace platform
}
// namespace platform
}
// namespace paddle
}
// namespace paddle
paddle/platform/curand.h
→
paddle/platform/
dynload/
curand.h
浏览文件 @
3567ea6d
...
@@ -19,21 +19,21 @@ limitations under the License. */
...
@@ -19,21 +19,21 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
platform
{
namespace
platform
{
namespace
dyload
{
namespace
dy
n
load
{
std
::
once_flag
curand_dso_flag
;
std
::
once_flag
curand_dso_flag
;
void
*
curand_dso_handle
=
nullptr
;
void
*
curand_dso_handle
=
nullptr
;
#ifdef PADDLE_USE_DSO
#ifdef PADDLE_USE_DSO
#define DYNAMIC_LOAD_CURAND_WRAP(__name) \
#define DYNAMIC_LOAD_CURAND_WRAP(__name)
\
struct DynLoad__##__name { \
struct DynLoad__##__name {
\
template <typename... Args> \
template <typename... Args>
\
curandStatus_t operator()(Args... args) { \
curandStatus_t operator()(Args... args) {
\
typedef curandStatus_t (*curandFunc)(Args...); \
typedef curandStatus_t (*curandFunc)(Args...);
\
std::call_once(curand_dso_flag, \
std::call_once(curand_dso_flag,
\
paddle::platform::dyload::GetCurandDsoHandle, \
paddle::platform::dy
n
load::GetCurandDsoHandle, \
&curand_dso_handle); \
&curand_dso_handle);
\
void *p_##__name = dlsym(curand_dso_handle, #__name); \
void *p_##__name = dlsym(curand_dso_handle, #__name);
\
return reinterpret_cast<curandFunc>(p_##__name)(args...); \
return reinterpret_cast<curandFunc>(p_##__name)(args...);
\
} \
}
\
} __name;
/* struct DynLoad__##__name */
} __name;
/* struct DynLoad__##__name */
#else
#else
#define DYNAMIC_LOAD_CURAND_WRAP(__name) \
#define DYNAMIC_LOAD_CURAND_WRAP(__name) \
...
@@ -60,6 +60,6 @@ CURAND_RAND_ROUTINE_EACH(DYNAMIC_LOAD_CURAND_WRAP)
...
@@ -60,6 +60,6 @@ CURAND_RAND_ROUTINE_EACH(DYNAMIC_LOAD_CURAND_WRAP)
#undef CURAND_RAND_ROUTINE_EACH
#undef CURAND_RAND_ROUTINE_EACH
#undef DYNAMIC_LOAD_CURAND_WRAP
#undef DYNAMIC_LOAD_CURAND_WRAP
}
// namespace dyload
}
// namespace dy
n
load
}
// namespace platform
}
// namespace platform
}
// namespace paddle
}
// namespace paddle
paddle/platform/dynamic_loader.cc
→
paddle/platform/dyn
load/dyn
amic_loader.cc
浏览文件 @
3567ea6d
...
@@ -36,7 +36,7 @@ DEFINE_string(lapack_dir, "", "Specify path for loading liblapack.so.");
...
@@ -36,7 +36,7 @@ DEFINE_string(lapack_dir, "", "Specify path for loading liblapack.so.");
namespace
paddle
{
namespace
paddle
{
namespace
platform
{
namespace
platform
{
namespace
dyload
{
namespace
dy
n
load
{
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
)
{
...
@@ -164,6 +164,6 @@ void GetLapackDsoHandle(void** dso_handle) {
...
@@ -164,6 +164,6 @@ void GetLapackDsoHandle(void** dso_handle) {
#endif
#endif
}
}
}
// namespace dyload
}
// namespace dy
n
load
}
// namespace platform
}
// namespace platform
}
// namespace paddle
}
// namespace paddle
paddle/platform/dynamic_loader.h
→
paddle/platform/dyn
load/dyn
amic_loader.h
浏览文件 @
3567ea6d
...
@@ -16,7 +16,7 @@ limitations under the License. */
...
@@ -16,7 +16,7 @@ limitations under the License. */
namespace
paddle
{
namespace
paddle
{
namespace
platform
{
namespace
platform
{
namespace
dyload
{
namespace
dy
n
load
{
/**
/**
* @brief load the DSO of CUBLAS
* @brief load the DSO of CUBLAS
...
@@ -58,6 +58,6 @@ void GetWarpCTCDsoHandle(void** dso_handle);
...
@@ -58,6 +58,6 @@ void GetWarpCTCDsoHandle(void** dso_handle);
*/
*/
void
GetLapackDsoHandle
(
void
**
dso_handle
);
void
GetLapackDsoHandle
(
void
**
dso_handle
);
}
// namespace dyload
}
// namespace dy
n
load
}
// namespace platform
}
// namespace platform
}
// namespace paddle
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录