Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f8d09011
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
f8d09011
编写于
4月 14, 2023
作者:
R
ronnywang
提交者:
GitHub
4月 14, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CustomDevice] add model parallel support for custom device (#52872)
上级
6b756e8c
变更
8
展开全部
隐藏空白更改
内联
并排
Showing
8 changed file
with
513 addition
and
20 deletion
+513
-20
paddle/fluid/distributed/collective/process_group.cc
paddle/fluid/distributed/collective/process_group.cc
+8
-4
paddle/fluid/distributed/collective/process_group.h
paddle/fluid/distributed/collective/process_group.h
+1
-1
paddle/fluid/operators/CMakeLists.txt
paddle/fluid/operators/CMakeLists.txt
+1
-1
paddle/fluid/operators/custom_device_common_op_registry.cc
paddle/fluid/operators/custom_device_common_op_registry.cc
+502
-0
paddle/fluid/pybind/distributed_py.cc
paddle/fluid/pybind/distributed_py.cc
+0
-1
python/paddle/distributed/__init__.py
python/paddle/distributed/__init__.py
+0
-3
python/paddle/distributed/collective.py
python/paddle/distributed/collective.py
+0
-10
python/paddle/fluid/__init__.py
python/paddle/fluid/__init__.py
+1
-0
未找到文件。
paddle/fluid/distributed/collective/process_group.cc
浏览文件 @
f8d09011
...
...
@@ -36,11 +36,15 @@ ProcessGroupIdMap& ProcessGroupIdMap::GetInstance() {
return
instance
;
}
void
ProcessGroupIdMap
::
DestroyProcessGroup
(
int
gid
)
{
int
use_count
=
ProcessGroupIdMap
::
GetInstance
()[
gid
].
use_count
();
for
(
int
i
=
0
;
i
<
use_count
;
++
i
)
{
ProcessGroupIdMap
::
GetInstance
()[
gid
].
reset
();
void
ProcessGroupIdMap
::
DestroyProcessGroup
()
{
auto
&
id_map
=
ProcessGroupIdMap
::
GetInstance
();
for
(
auto
iter
=
id_map
.
begin
();
iter
!=
id_map
.
end
();
++
iter
)
{
auto
use_count
=
iter
->
second
.
use_count
();
for
(
int
i
=
0
;
i
<
use_count
;
++
i
)
{
iter
->
second
.
reset
();
}
}
id_map
.
clear
();
}
}
// namespace distributed
...
...
paddle/fluid/distributed/collective/process_group.h
浏览文件 @
f8d09011
...
...
@@ -502,7 +502,7 @@ class ProcessGroupIdMap
:
public
std
::
unordered_map
<
int
,
std
::
shared_ptr
<
ProcessGroup
>>
{
public:
static
ProcessGroupIdMap
&
GetInstance
();
static
void
DestroyProcessGroup
(
int
gid
);
static
void
DestroyProcessGroup
();
};
// TODO(dev): The following method will be removed soon.
...
...
paddle/fluid/operators/CMakeLists.txt
浏览文件 @
f8d09011
...
...
@@ -215,7 +215,7 @@ endif()
copy_if_different
(
${
pybind_file
}
${
pybind_file_final
}
)
if
(
WITH_CUSTOM_DEVICE
)
cc_library
(
custom_device_common_op_registry SRCS custom_device_common_op_registry.cc DEPS operator
)
cc_library
(
custom_device_common_op_registry SRCS custom_device_common_op_registry.cc DEPS operator
phi_api
)
endif
()
if
(
NOT
"
${
OP_LIST
}
"
STREQUAL
""
)
...
...
paddle/fluid/operators/custom_device_common_op_registry.cc
浏览文件 @
f8d09011
此差异已折叠。
点击以展开。
paddle/fluid/pybind/distributed_py.cc
浏览文件 @
f8d09011
...
...
@@ -1357,7 +1357,6 @@ void BindDistributed(py::module *m) {
*
m
,
"ProcessGroupIdMap"
)
.
def_static
(
"destroy"
,
distributed
::
ProcessGroupIdMap
::
DestroyProcessGroup
,
py
::
arg
(
"group_id"
)
=
0
,
py
::
call_guard
<
py
::
gil_scoped_release
>
());
}
...
...
python/paddle/distributed/__init__.py
浏览文件 @
f8d09011
...
...
@@ -32,7 +32,6 @@ from paddle.distributed.fleet.base.topology import ParallelMode # noqa: F401
from
.collective
import
split
# noqa: F401
from
.collective
import
new_group
# noqa: F401
from
.collective
import
is_available
from
.collective
import
_destroy_process_group_id_map
from
.communication
import
(
stream
,
ReduceOp
,
...
...
@@ -122,5 +121,3 @@ __all__ = [ # noqa
"is_available"
,
"get_backend"
,
]
atexit
.
register
(
_destroy_process_group_id_map
)
python/paddle/distributed/collective.py
浏览文件 @
f8d09011
...
...
@@ -172,16 +172,6 @@ def _set_custom_gid(gid):
_custom_gid
=
gid
def
_destroy_process_group_id_map
():
"""
Destroy the custom process group. Designed for CustomDevice.
"""
core
.
ProcessGroupIdMap
.
destroy
()
def
new_group
(
ranks
=
None
,
backend
=
None
,
timeout
=
_default_timeout
):
"""
...
...
python/paddle/fluid/__init__.py
浏览文件 @
f8d09011
...
...
@@ -223,3 +223,4 @@ atexit.register(core.clear_executor_cache)
# Keep clear_kernel_factory running before clear_device_manager
atexit
.
register
(
core
.
clear_device_manager
)
atexit
.
register
(
core
.
clear_kernel_factory
)
atexit
.
register
(
core
.
ProcessGroupIdMap
.
destroy
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录