-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add Gloo SendRecv Function #52221
Add Gloo SendRecv Function #52221
Conversation
你的PR提交成功,感谢你对开源项目的贡献! |
tensor_y = paddle.to_tensor(y) | ||
|
||
send_recv_result = paddle.assign(tensor_x) | ||
if rank == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Use
pg.rank
would be better - add send from 1 to 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if pg.rank() == 0: | ||
task = pg.send(tensor_x, 1, True) | ||
else: | ||
task = pg.recv(tensor_y_1, 0, True) | ||
assert np.array_equal(send_recv_result_1, tensor_y_1) | ||
|
||
if pg.rank() == 0: | ||
task = pg.recv(tensor_x, 1, True) | ||
assert np.array_equal(send_recv_result_2, tensor_x) | ||
else: | ||
task = pg.send(tensor_y_2, 0, True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part can be merged.
const auto slot = gloo::Slot::build(kSendRecvSlotPrefix, opts->tag); | ||
|
||
if (context->rank == opts->src) { | ||
in->send((context->rank + 1) % 2, slot); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why (context->rank + 1) % 2
? Same below.
Does gloo support P2P communication even if the world size of the process group is larger than 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
PR types
New features
PR changes
OPs
Describe
Add Gloo SendRecv Function