Repository navigation
[Dist Profiling] Enable profiling for gloo send/recv - #52004
rohan-varma wants to merge 5 commits into
Conversation
Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests. Differential Revision: [D26347164](https://our.internmc.facebook.com/intern/diff/D26347164/) [ghstack-poisoned]
💊 CI failures summary and remediationsAs of commit c1e814d (more details on the Dr. CI page):
This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.Please report bugs/suggestions to the (internal) Dr. CI Users group. |
Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests. Differential Revision: [D26347164](https://our.internmc.facebook.com/intern/diff/D26347164/) [ghstack-poisoned]
Pull Request resolved: #52004 Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests. ghstack-source-id: 121398086 Differential Revision: [D26347164](https://our.internmc.facebook.com/intern/diff/D26347164/)
Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests. Differential Revision: [D26347164](https://our.internmc.facebook.com/intern/diff/D26347164/) [ghstack-poisoned]
Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests. Differential Revision: [D26347164](https://our.internmc.facebook.com/intern/diff/D26347164/) [ghstack-poisoned]
| -1, | ||
| OpType::UNKNOWN, | ||
| profilingTitle, | ||
| c10::optional<std::vector<at::Tensor>>({tensor})), |
There was a problem hiding this comment.
For receive op, the output tensor does not have it's final dimension until end of the operation right? Then does it record the operator shape correctly?
There was a problem hiding this comment.
I think if the user does something like:
# on rank 1
dist.recv(tensor, src=0)
Then tensor is expected to be correctly sized with whatever tensor rank 0 is sending to 1. This appears to be true in all our tests in distributed_test.py and also the docs imply this: https://github.com/pytorch/pytorch/blob/master/torch/distributed/distributed_c10d.py#L819.
So we should be fine if we just record the shape of the tensor input into recv, and this seems to work with the unittests below as well.
There was a problem hiding this comment.
I could not understand it from the docs. If the API does not require that explicitly, could you double check that in case the output tensor is not sized prior to call, recv does not work properly?
There was a problem hiding this comment.
Sure, I just re-verified this in the tests. In test_send_recv, if you change:
output_tensor = _build_tensor(recv_size, value=-1) to
output_tensor = _build_tensor(recv_size -1, value=-1) we run into the following error:
W0211 16:35:58.875078 813884 ExceptionTracer.cpp:185] Invalid trace stack for exception of type: gl
oo::EnforceNotMet
terminate called after throwing an instance of 'gloo::EnforceNotMet'
what(): [enforce fail at gloo/transport/tcp/pair.cc:510] op.preamble.length <= op.nbytes. 4 vs 0
/data/users/rvarm1/fbsource/fbcode/buck-out/dev/gen/caffe2/test/distributed/distributed_nccl_fork#b
inary,link-tree/torch/testing/_internal/common_distributed.py:292: Caught exception:
Traceback (most recent call last):
File "/data/users/rvarm1/fbsource/fbcode/buck-out/dev/gen/caffe2/test/distributed/distributed_ncc
l_fork#binary,link-tree/torch/testing/_internal/common_distributed.py", line 289, in wrapper
fn()
File "/data/users/rvarm1/fbsource/fbcode/buck-out/dev/gen/caffe2/test/distributed/distributed_ncc
l_fork#binary,link-tree/torch/testing/_internal/distributed/distributed_test.py", line 885, in test
_send_recv
dist.recv(output_tensor, src)
File "/data/users/rvarm1/fbsource/fbcode/buck-out/dev/gen/caffe2/test/distributed/distributed_ncc
l_fork#binary,link-tree/torch/distributed/distributed_c10d.py", line 850, in recv
pg.recv([tensor], src, tag).wait()
RuntimeError: [gloo/transport/tcp/pair.cc:589] Read error [2401:db00:21:6045:face:0:5:0]:12722: Con
nection reset by peer
exiting process with exit code: 10
Process 0 terminated with exit code 10, terminating remaining processes.
ERROR
So it looks like tensor cannot be smaller than send tensor. However, if the recv tensor size is larger, then the recv succeeds, and we record this larger shape. However I believe that this is the desired behavior, since the larger tensor is what is input into gloo:recv buffer.
Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests. Differential Revision: [D26347164](https://our.internmc.facebook.com/intern/diff/D26347164/) [ghstack-poisoned]
|
This pull request has been merged in 7b21c6b. |
Summary: Pull Request resolved: pytorch#52004 Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests. ghstack-source-id: 121507511 Test Plan: CI Reviewed By: mrzzd Differential Revision: D26347164 fbshipit-source-id: f4d1c474fccf40d5776fc13c4add7a053ea08960
Summary: Pull Request resolved: pytorch#52004 Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests. ghstack-source-id: 121507511 Test Plan: CI Reviewed By: mrzzd Differential Revision: D26347164 fbshipit-source-id: f4d1c474fccf40d5776fc13c4add7a053ea08960
Summary: Pull Request resolved: pytorch#52004 Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests. ghstack-source-id: 121507511 Test Plan: CI Reviewed By: mrzzd Differential Revision: D26347164 fbshipit-source-id: f4d1c474fccf40d5776fc13c4add7a053ea08960
Stack from ghstack:
Enables profiling of p2p collectives for Gloo. Modified/added relevant unittests.
Differential Revision: D26347164