Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
e0b50269
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看板
未验证
提交
e0b50269
编写于
1月 11, 2023
作者:
W
Wen Sun
提交者:
GitHub
1月 11, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: rm fluid deps in distributed communication (#49722)
上级
b1faa562
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
33 addition
and
45 deletion
+33
-45
python/paddle/distributed/communication/all_gather.py
python/paddle/distributed/communication/all_gather.py
+1
-1
python/paddle/distributed/communication/batch_isend_irecv.py
python/paddle/distributed/communication/batch_isend_irecv.py
+3
-4
python/paddle/distributed/communication/broadcast.py
python/paddle/distributed/communication/broadcast.py
+1
-1
python/paddle/distributed/communication/group.py
python/paddle/distributed/communication/group.py
+5
-7
python/paddle/distributed/communication/reduce.py
python/paddle/distributed/communication/reduce.py
+5
-6
python/paddle/distributed/communication/scatter.py
python/paddle/distributed/communication/scatter.py
+1
-1
python/paddle/distributed/communication/stream/all_gather.py
python/paddle/distributed/communication/stream/all_gather.py
+2
-3
python/paddle/distributed/communication/stream/all_reduce.py
python/paddle/distributed/communication/stream/all_reduce.py
+2
-3
python/paddle/distributed/communication/stream/all_to_all.py
python/paddle/distributed/communication/stream/all_to_all.py
+2
-3
python/paddle/distributed/communication/stream/broadcast.py
python/paddle/distributed/communication/stream/broadcast.py
+2
-3
python/paddle/distributed/communication/stream/recv.py
python/paddle/distributed/communication/stream/recv.py
+2
-3
python/paddle/distributed/communication/stream/reduce.py
python/paddle/distributed/communication/stream/reduce.py
+2
-3
python/paddle/distributed/communication/stream/reduce_scatter.py
...paddle/distributed/communication/stream/reduce_scatter.py
+1
-1
python/paddle/distributed/communication/stream/scatter.py
python/paddle/distributed/communication/stream/scatter.py
+2
-3
python/paddle/distributed/communication/stream/send.py
python/paddle/distributed/communication/stream/send.py
+2
-3
未找到文件。
python/paddle/distributed/communication/all_gather.py
浏览文件 @
e0b50269
...
...
@@ -16,7 +16,7 @@ import numpy as np
import
paddle
import
paddle.distributed.communication.stream
as
stream
import
paddle.f
luid.f
ramework
as
framework
import
paddle.framework
as
framework
from
.serialization_utils
import
(
convert_object_to_tensor
,
...
...
python/paddle/distributed/communication/batch_isend_irecv.py
浏览文件 @
e0b50269
...
...
@@ -15,8 +15,7 @@
import
contextlib
import
paddle.distributed
as
dist
import
paddle.fluid.core
as
core
import
paddle.fluid.framework
as
framework
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
(
_get_global_group
,
_warn_cur_rank_not_in_group
,
...
...
@@ -79,12 +78,12 @@ class P2POp:
@
contextlib
.
contextmanager
def
_with_batch_p2p_guard
(
backend
):
if
backend
==
"NCCL"
:
core
.
ProcessGroupNCCL
.
group_start
()
framework
.
core
.
ProcessGroupNCCL
.
group_start
()
try
:
yield
finally
:
if
backend
==
"NCCL"
:
core
.
ProcessGroupNCCL
.
group_end
()
framework
.
core
.
ProcessGroupNCCL
.
group_end
()
def
_check_p2p_op_list
(
p2p_op_list
):
...
...
python/paddle/distributed/communication/broadcast.py
浏览文件 @
e0b50269
...
...
@@ -15,7 +15,7 @@
import
paddle
import
paddle.distributed
as
dist
import
paddle.distributed.communication.stream
as
stream
import
paddle.f
luid.f
ramework
as
framework
import
paddle.framework
as
framework
from
.serialization_utils
import
(
convert_object_to_tensor
,
...
...
python/paddle/distributed/communication/group.py
浏览文件 @
e0b50269
...
...
@@ -16,9 +16,7 @@ import warnings
import
paddle
import
paddle.distributed
as
dist
import
paddle.fluid.core
as
core
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layer_helper
as
layer_helper
import
paddle.framework
as
framework
class
Group
:
...
...
@@ -239,7 +237,7 @@ def _sync_calc_stream(tensor):
return
paddle
.
_legacy_C_ops
.
c_sync_calc_stream
(
tensor
,
tensor
)
else
:
op_type
=
'c_sync_calc_stream'
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
helper
.
append_op
(
type
=
op_type
,
inputs
=
{
'X'
:
[
tensor
]},
...
...
@@ -254,7 +252,7 @@ def _sync_comm_stream(tensor, ring_id=0):
)
else
:
op_type
=
'c_sync_comm_stream'
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
helper
.
append_op
(
type
=
op_type
,
inputs
=
{
'X'
:
[
tensor
]},
...
...
@@ -325,7 +323,7 @@ def barrier(group=None):
if
framework
.
in_dygraph_mode
():
group
=
_get_global_group
()
if
group
is
None
else
group
place
=
framework
.
_current_expected_place
()
if
isinstance
(
place
,
core
.
CPUPlace
):
if
isinstance
(
place
,
framework
.
CPUPlace
):
task
=
group
.
process_group
.
barrier
()
else
:
device_id
=
place
.
get_device_id
()
...
...
@@ -344,7 +342,7 @@ def barrier(group=None):
op_type
=
'barrier'
if
not
isinstance
(
ring_id
,
int
):
raise
ValueError
(
"The type of 'group' for barrier must be int."
)
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
helper
.
append_op
(
type
=
op_type
,
inputs
=
{
'X'
:
[
barrier_tensor
]},
...
...
python/paddle/distributed/communication/reduce.py
浏览文件 @
e0b50269
...
...
@@ -14,8 +14,7 @@
import
paddle
import
paddle.distributed.communication.stream
as
stream
import
paddle.fluid.core
as
core
import
paddle.fluid.framework
as
framework
import
paddle.framework
as
framework
class
ReduceOp
:
...
...
@@ -59,13 +58,13 @@ class ReduceOp:
def
_get_reduce_op
(
reduce_op
,
func_name
):
if
framework
.
in_dygraph_mode
():
if
reduce_op
==
ReduceOp
.
SUM
:
return
core
.
ReduceOp
.
SUM
return
framework
.
core
.
ReduceOp
.
SUM
elif
reduce_op
==
ReduceOp
.
MAX
:
return
core
.
ReduceOp
.
MAX
return
framework
.
core
.
ReduceOp
.
MAX
elif
reduce_op
==
ReduceOp
.
MIN
:
return
core
.
ReduceOp
.
MIN
return
framework
.
core
.
ReduceOp
.
MIN
elif
reduce_op
==
ReduceOp
.
PROD
:
return
core
.
ReduceOp
.
PRODUCT
return
framework
.
core
.
ReduceOp
.
PRODUCT
else
:
if
reduce_op
==
ReduceOp
.
SUM
:
return
'c_{}_sum'
.
format
(
func_name
)
...
...
python/paddle/distributed/communication/scatter.py
浏览文件 @
e0b50269
...
...
@@ -17,7 +17,7 @@ import numpy as np
import
paddle
import
paddle.distributed
as
dist
import
paddle.distributed.communication.stream
as
stream
import
paddle.f
luid.f
ramework
as
framework
import
paddle.framework
as
framework
from
.serialization_utils
import
(
convert_object_to_tensor
,
...
...
python/paddle/distributed/communication/stream/all_gather.py
浏览文件 @
e0b50269
...
...
@@ -15,8 +15,7 @@
import
paddle
import
paddle.distributed
as
dist
import
paddle.fluid.data_feeder
as
data_feeder
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layer_helper
as
layer_helper
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
_get_global_group
...
...
@@ -62,7 +61,7 @@ def _all_gather_in_dygraph(
def
_all_gather_in_static_mode
(
tensor_list
,
tensor
,
group
,
sync_op
):
op_type
=
'c_allgather'
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
out
=
helper
.
create_variable_for_type_inference
(
dtype
=
tensor
.
dtype
)
for
elem
in
tensor_list
:
data_feeder
.
check_variable_and_dtype
(
...
...
python/paddle/distributed/communication/stream/all_reduce.py
浏览文件 @
e0b50269
...
...
@@ -13,8 +13,7 @@
# limitations under the License.
import
paddle.fluid.data_feeder
as
data_feeder
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layer_helper
as
layer_helper
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
(
_get_global_group
,
_warn_cur_rank_not_in_group
,
...
...
@@ -60,7 +59,7 @@ def _all_reduce_in_static_mode(tensor, op, group, sync_op, use_calc_stream):
# TODO: Support task and use task.wait in static graph mode
# Use use_calc_stream rather than sync_op
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
helper
.
append_op
(
type
=
op_type
,
inputs
=
{
'X'
:
[
tensor
]},
...
...
python/paddle/distributed/communication/stream/all_to_all.py
浏览文件 @
e0b50269
...
...
@@ -15,8 +15,7 @@
import
paddle
import
paddle.distributed
as
dist
import
paddle.fluid.data_feeder
as
data_feeder
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layer_helper
as
layer_helper
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
(
_get_global_group
,
_warn_cur_rank_not_in_group
,
...
...
@@ -73,7 +72,7 @@ def _all_to_all_in_static_mode(
op_type
=
'alltoall'
ring_id
=
0
if
group
is
None
else
group
.
id
nranks
=
dist
.
get_world_size
()
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
in_tensor
=
in_tensor_or_tensor_list
if
isinstance
(
in_tensor_or_tensor_list
,
list
):
...
...
python/paddle/distributed/communication/stream/broadcast.py
浏览文件 @
e0b50269
...
...
@@ -13,8 +13,7 @@
# limitations under the License.
import
paddle.fluid.data_feeder
as
data_feeder
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layer_helper
as
layer_helper
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
(
_get_global_group
,
_get_or_throw_group_rank
,
...
...
@@ -57,7 +56,7 @@ def _broadcast_in_static_mode(
)
op_type
=
'c_broadcast'
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
ring_id
=
0
if
group
is
None
else
group
.
id
helper
.
append_op
(
...
...
python/paddle/distributed/communication/stream/recv.py
浏览文件 @
e0b50269
...
...
@@ -13,8 +13,7 @@
# limitations under the License.
import
paddle.fluid.data_feeder
as
data_feeder
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layer_helper
as
layer_helper
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
(
_get_global_group
,
_get_or_throw_group_rank
,
...
...
@@ -48,7 +47,7 @@ def _recv_in_static_mode(
'recv'
,
)
ring_id
=
0
if
group
is
None
else
group
.
id
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
helper
.
append_op
(
type
=
op_type
,
outputs
=
{
'Out'
:
[
tensor
]},
...
...
python/paddle/distributed/communication/stream/reduce.py
浏览文件 @
e0b50269
...
...
@@ -13,8 +13,7 @@
# limitations under the License.
import
paddle.fluid.data_feeder
as
data_feeder
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layer_helper
as
layer_helper
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
(
_get_global_group
,
_get_or_throw_group_rank
,
...
...
@@ -63,7 +62,7 @@ def _reduce_in_static_mode(
op_type
=
_get_reduce_op
(
op
,
"reduce"
)
ring_id
=
0
if
group
is
None
else
group
.
id
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
helper
.
append_op
(
type
=
op_type
,
inputs
=
{
'X'
:
[
tensor
]},
...
...
python/paddle/distributed/communication/stream/reduce_scatter.py
浏览文件 @
e0b50269
...
...
@@ -13,7 +13,7 @@
# limitations under the License.
import
paddle
import
paddle.f
luid.f
ramework
as
framework
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
(
_get_global_group
,
_warn_cur_rank_not_in_group
,
...
...
python/paddle/distributed/communication/stream/scatter.py
浏览文件 @
e0b50269
...
...
@@ -17,8 +17,7 @@ import warnings
import
paddle
import
paddle.distributed
as
dist
import
paddle.fluid.data_feeder
as
data_feeder
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layer_helper
as
layer_helper
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
(
_get_global_group
,
_get_or_throw_group_rank
,
...
...
@@ -113,7 +112,7 @@ def _scatter_in_static_mode(
)
op_type
=
'c_scatter'
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
helper
.
append_op
(
type
=
op_type
,
inputs
=
{
'X'
:
[
input_tensor
]},
...
...
python/paddle/distributed/communication/stream/send.py
浏览文件 @
e0b50269
...
...
@@ -13,8 +13,7 @@
# limitations under the License.
import
paddle.fluid.data_feeder
as
data_feeder
import
paddle.fluid.framework
as
framework
import
paddle.fluid.layer_helper
as
layer_helper
import
paddle.framework
as
framework
from
paddle.distributed.communication.group
import
(
_get_global_group
,
_get_or_throw_group_rank
,
...
...
@@ -49,7 +48,7 @@ def _send_in_static_mode(
)
ring_id
=
0
if
group
is
None
else
group
.
id
helper
=
layer_helper
.
LayerHelper
(
op_type
,
**
locals
())
helper
=
framework
.
LayerHelper
(
op_type
,
**
locals
())
helper
.
append_op
(
type
=
op_type
,
inputs
=
{
'X'
:
[
tensor
]},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录