Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
b3bcebbe
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看板
未验证
提交
b3bcebbe
编写于
4月 07, 2022
作者:
T
Thunderbrook
提交者:
GitHub
4月 07, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[GPUPS] bind afs wrpper (#41227)
* afs wrapper * format * format * macro
上级
9714878c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
85 addition
and
0 deletion
+85
-0
paddle/fluid/framework/fleet/ps_gpu_wrapper.cc
paddle/fluid/framework/fleet/ps_gpu_wrapper.cc
+37
-0
paddle/fluid/framework/fleet/ps_gpu_wrapper.h
paddle/fluid/framework/fleet/ps_gpu_wrapper.h
+21
-0
paddle/fluid/pybind/ps_gpu_wrapper_py.cc
paddle/fluid/pybind/ps_gpu_wrapper_py.cc
+21
-0
paddle/fluid/pybind/ps_gpu_wrapper_py.h
paddle/fluid/pybind/ps_gpu_wrapper_py.h
+3
-0
paddle/fluid/pybind/pybind.cc
paddle/fluid/pybind/pybind.cc
+3
-0
未找到文件。
paddle/fluid/framework/fleet/ps_gpu_wrapper.cc
浏览文件 @
b3bcebbe
...
...
@@ -37,6 +37,43 @@ limitations under the License. */
namespace
paddle
{
namespace
framework
{
#ifdef PADDLE_WITH_PSLIB
void
AfsWrapper
::
init
(
const
std
::
string
&
fs_name
,
const
std
::
string
&
fs_user
,
const
std
::
string
&
pass_wd
,
const
std
::
string
&
conf
)
{
int
ret
=
afs_handler_
.
init
(
fs_name
.
c_str
(),
fs_user
.
c_str
(),
pass_wd
.
c_str
(),
conf
.
c_str
());
if
(
ret
!=
0
)
{
LOG
(
ERROR
)
<<
"AFS Init Error"
;
}
}
int
AfsWrapper
::
remove
(
const
std
::
string
&
path
)
{
return
afs_handler_
.
remove
(
path
);
}
int
AfsWrapper
::
mkdir
(
const
std
::
string
&
path
)
{
return
afs_handler_
.
mkdir
(
path
);
}
std
::
vector
<
std
::
string
>
AfsWrapper
::
list
(
const
std
::
string
&
path
)
{
return
afs_handler_
.
list
(
path
);
}
int
AfsWrapper
::
exist
(
const
std
::
string
&
path
)
{
return
afs_handler_
.
exist
(
path
);
}
int
AfsWrapper
::
upload
(
const
std
::
string
&
local_file
,
const
std
::
string
&
afs_file
)
{
return
afs_handler_
.
upload_file
(
local_file
,
afs_file
);
}
int
AfsWrapper
::
download
(
const
std
::
string
&
local_file
,
const
std
::
string
&
afs_file
)
{
return
afs_handler_
.
download_file
(
local_file
,
afs_file
);
}
#endif
std
::
shared_ptr
<
PSGPUWrapper
>
PSGPUWrapper
::
s_instance_
=
NULL
;
bool
PSGPUWrapper
::
is_initialized_
=
false
;
#ifdef PADDLE_WITH_PSLIB
...
...
paddle/fluid/framework/fleet/ps_gpu_wrapper.h
浏览文件 @
b3bcebbe
...
...
@@ -55,6 +55,27 @@ namespace framework {
#define TYPEALIGN(ALIGNVAL, LEN) \
(((uint64_t)(LEN) + ((ALIGNVAL)-1)) & ~((uint64_t)((ALIGNVAL)-1)))
#ifdef PADDLE_WITH_PSLIB
class
AfsWrapper
{
public:
AfsWrapper
()
{}
virtual
~
AfsWrapper
()
{}
void
init
(
const
std
::
string
&
fs_name
,
const
std
::
string
&
fs_user
,
const
std
::
string
&
pass_wd
,
const
std
::
string
&
conf
);
int
remove
(
const
std
::
string
&
path
);
int
mkdir
(
const
std
::
string
&
path
);
std
::
vector
<
std
::
string
>
list
(
const
std
::
string
&
path
);
int
exist
(
const
std
::
string
&
path
);
int
upload
(
const
std
::
string
&
local_file
,
const
std
::
string
&
afs_file
);
int
download
(
const
std
::
string
&
local_file
,
const
std
::
string
&
afs_file
);
private:
paddle
::
ps
::
AfsApiWrapper
afs_handler_
;
};
#endif
class
PSGPUWrapper
{
public:
virtual
~
PSGPUWrapper
()
{
delete
HeterPs_
;
}
...
...
paddle/fluid/pybind/ps_gpu_wrapper_py.cc
浏览文件 @
b3bcebbe
...
...
@@ -63,6 +63,27 @@ void BindPSGPUWrapper(py::module* m) {
.
def
(
"finalize"
,
&
framework
::
PSGPUWrapper
::
Finalize
,
py
::
call_guard
<
py
::
gil_scoped_release
>
());
}
// end PSGPUWrapper
#ifdef PADDLE_WITH_PSLIB
void
BindAfsWrapper
(
py
::
module
*
m
)
{
py
::
class_
<
framework
::
AfsWrapper
,
std
::
shared_ptr
<
framework
::
AfsWrapper
>>
(
*
m
,
"AfsWrapper"
)
.
def
(
py
::
init
([]()
{
return
std
::
make_shared
<
framework
::
AfsWrapper
>
();
}))
.
def
(
"init"
,
&
framework
::
AfsWrapper
::
init
,
py
::
call_guard
<
py
::
gil_scoped_release
>
())
.
def
(
"list"
,
&
framework
::
AfsWrapper
::
list
,
py
::
call_guard
<
py
::
gil_scoped_release
>
())
.
def
(
"mkdir"
,
&
framework
::
AfsWrapper
::
mkdir
,
py
::
call_guard
<
py
::
gil_scoped_release
>
())
.
def
(
"exist"
,
&
framework
::
AfsWrapper
::
exist
,
py
::
call_guard
<
py
::
gil_scoped_release
>
())
.
def
(
"download"
,
&
framework
::
AfsWrapper
::
download
,
py
::
call_guard
<
py
::
gil_scoped_release
>
())
.
def
(
"upload"
,
&
framework
::
AfsWrapper
::
upload
,
py
::
call_guard
<
py
::
gil_scoped_release
>
())
.
def
(
"remove"
,
&
framework
::
AfsWrapper
::
remove
,
py
::
call_guard
<
py
::
gil_scoped_release
>
());
}
#endif
#endif
}
// end namespace pybind
}
// end namespace paddle
paddle/fluid/pybind/ps_gpu_wrapper_py.h
浏览文件 @
b3bcebbe
...
...
@@ -24,6 +24,9 @@ namespace pybind {
#ifdef PADDLE_WITH_HETERPS
void
BindPSGPUWrapper
(
py
::
module
*
m
);
#ifdef PADDLE_WITH_PSLIB
void
BindAfsWrapper
(
py
::
module
*
m
);
#endif
#endif
}
// namespace pybind
}
// namespace paddle
paddle/fluid/pybind/pybind.cc
浏览文件 @
b3bcebbe
...
...
@@ -4458,6 +4458,9 @@ All parameter, weight, gradient are variables in Paddle.
#endif
#ifdef PADDLE_WITH_HETERPS
BindPSGPUWrapper
(
&
m
);
#ifdef PADDLE_WITH_PSLIB
BindAfsWrapper
(
&
m
);
#endif
#endif
BindGlooWrapper
(
&
m
);
BindBoxHelper
(
&
m
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录