pytorch icon indicating copy to clipboard operation
pytorch copied to clipboard

Expose an out-of-place _reduce_oop from ProcessGroupNCCL

Open aashaka opened this issue 3 years ago • 6 comments

Summary: This change exposes an out-of-place _reduce_oop API from the ProcessGroupNCCL. It allows reducing an input tensor and placing the output in a separate output tensor.

Custom collectives may be implemented by coalescing reduce operations. One such use-case is implementing a vector reduce_scatter (reduce_scatter_v) where inputs have to be reduced and scattered unevenly among participating ranks. Since reduce_scatter provides an out-of-place API, a reduce_scatter_v semantic implemented inside dist.reduce_scatter also needs to support out-of-place, for which an out-of-place reduce is required to be exposed.

Test Plan: Adds test_reduce_oop_ops in caffe2/test/distributed/test_c10d_nccl.py to test the newly exposed _reduce_oop function in ProcessGroupNCCL.

Differential Revision: D38478781

aashaka avatar Aug 05 '22 23:08 aashaka

:link: Helpful links

:white_check_mark: No Failures (1 Pending)

As of commit 4ace6629b9 (more details on the Dr. CI page):

Expand to see more

:green_heart: :green_heart: Looks good so far! There are no failures yet. :green_heart: :green_heart:


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

facebook-github-bot avatar Aug 05 '22 23:08 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D38478781

facebook-github-bot avatar Aug 05 '22 23:08 facebook-github-bot

Maybe also worth writing a bit in the PR description about the context -- You need out-of-place reduce from the backend because you want to compose a reduce_scatter_v pattern at the Python front end using coalesced reduces. Today, the dist.reduce_scatter API supports out-of-place, so, if the reduce_scatter_v pattern is implemented under the dist.reduce_scatter API, you would need out-of-place support as well.

kwen2501 avatar Aug 06 '22 00:08 kwen2501

Also good to comment the above in code.

kwen2501 avatar Aug 06 '22 00:08 kwen2501

This pull request was exported from Phabricator. Differential Revision: D38478781

facebook-github-bot avatar Aug 08 '22 18:08 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D38478781

facebook-github-bot avatar Aug 09 '22 18:08 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D38478781

facebook-github-bot avatar Aug 15 '22 22:08 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D38478781

facebook-github-bot avatar Aug 15 '22 23:08 facebook-github-bot

This pull request was exported from Phabricator. Differential Revision: D38478781

facebook-github-bot avatar Aug 17 '22 19:08 facebook-github-bot

@pytorchbot merge

kwen2501 avatar Aug 18 '22 02:08 kwen2501

@pytorchbot successfully started a merge job. Check the current status here. The merge job was triggered without a flag. This means that your change will be merged once all checks on your PR have passed (ETA: 0-4 Hours). If this is not the intended behavior, feel free to use some of the other merge options in the wiki. Please reach out to the PyTorch DevX Team with feedback or questions!

pytorchmergebot avatar Aug 18 '22 02:08 pytorchmergebot

Hey @aashaka. You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'. For changes that are 'topic: not user facing' there is no need for a release notes label.

github-actions[bot] avatar Aug 18 '22 02:08 github-actions[bot]