Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug of old pipeline #44361

Merged
merged 1 commit into from
Jul 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions python/paddle/distributed/collective.py
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,10 @@ def alltoall_single(in_tensor,
return task


def _get_group_rank(global_rank, group=None):
return global_rank if group is None else group.get_group_rank(global_rank)


def send(tensor, dst=0, group=None, use_calc_stream=True):
"""
Send a tensor to the receiver.
Expand Down Expand Up @@ -2062,11 +2066,10 @@ def send(tensor, dst=0, group=None, use_calc_stream=True):
"""
if group is not None and not group.is_member():
return

dst = _get_group_rank(dst, group)
if in_dygraph_mode():
group = _get_default_group() if group is None else group
group_dst_rank = group.get_group_rank(dst)
task = group.process_group.send(tensor, group_dst_rank)
task = group.process_group.send(tensor, dst)
if use_calc_stream:
task.wait()
return None
Expand Down Expand Up @@ -2126,10 +2129,10 @@ def recv(tensor, src=0, group=None, use_calc_stream=True):
if group is not None and not group.is_member():
return

src = _get_group_rank(src, group)
if in_dygraph_mode():
group = _get_default_group() if group is None else group
group_src_rank = group.get_group_rank(src)
task = group.process_group.recv(tensor, group_src_rank)
task = group.process_group.recv(tensor, src)
if use_calc_stream:
task.wait()
return None
Expand Down