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

[4/N] [Dispatchable Collectives] Update all_reduce_ with CPU / CUDA implementations #83810

Closed
wants to merge 13 commits into from

Conversation

H-Huang
Copy link
Member

@H-Huang H-Huang commented Aug 20, 2022

Stack from ghstack:

About this PR

  • Update the all_reduce op to dispatch to cpu and cuda implementations. Right now they both perform the same logic so this is essentially a no-op.
  • Update test to validate that a separate device implementation is not supported.

Context

#86225

Differential Revision: D39506979

@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Aug 20, 2022

🔗 Helpful links

✅ No Failures (22 Pending)

As of commit 29a2486 (more details on the Dr. CI page):

Expand to see more

💚 💚 Looks good so far! There are no failures yet. 💚 💚


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 facebook-github-bot added the oncall: distributed Add this issue/PR to distributed oncall triage queue label Aug 20, 2022
H-Huang added a commit that referenced this pull request Aug 20, 2022
…mplementations

ghstack-source-id: be18410d00cd737835b5aeb68ed6ee23902833a1
Pull Request resolved: #83810
@H-Huang H-Huang requested a review from kwen2501 August 20, 2022 22:09
@H-Huang H-Huang added module: c10d Issues/PRs related to collective communications and process groups release notes: distributed (c10d) release notes category topic: new features topic category labels Aug 20, 2022
…PU / CUDA implementations"

[ghstack-poisoned]
H-Huang added a commit that referenced this pull request Aug 22, 2022
…mplementations

ghstack-source-id: a7471b2c8deaabc3113e2fa01493fd80b2cc774e
Pull Request resolved: #83810
…PU / CUDA implementations"

[ghstack-poisoned]
H-Huang added a commit that referenced this pull request Aug 22, 2022
…mplementations

ghstack-source-id: 5dd79ca430a5ff5c1530db15b8e2a1cab3dc2715
Pull Request resolved: #83810
…PU / CUDA implementations"

[ghstack-poisoned]
Copy link
Contributor

@kwen2501 kwen2501 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

// sparse all_reduce in the Gloo backend
TORCH_LIBRARY_IMPL(c10d, SparseCPU, m) {
m.impl("allreduce_", allreduce_cpu_);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: is there actually a SparseCPU or SparseCUDA implementation in Gloo?
If not, do we need to add it here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is logic within allreduce() to handle sparse tensors (https://github.com/pytorch/pytorch/blob/master/torch/csrc/distributed/c10d/ProcessGroupGloo.cpp#L1465-L1467) to which it branches to different logic, so having each implementation just call allreduce_ keeps behavior the same, but I think there may be a cleaner way to do this, we should discuss this.

@pytorch-bot
Copy link

pytorch-bot bot commented Sep 13, 2022

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/83810

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 84a5880:
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

…PU / CUDA implementations"

[ghstack-poisoned]
@H-Huang
Copy link
Member Author

H-Huang commented Sep 14, 2022

@H-Huang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

…PU / CUDA implementations"


### About this PR
* Update the all_reduce op to dispatch to cpu and cuda implementations. Right now they both perform the same logic so this is essentially a no-op.
* Update test to validate that a separate device implementation is not supported.

### About this stack
In the future we will repurpose ProcessGroup to instead contain a list of Backends (ProcessGroupNCCL/Gloo/UCC) and perform dispatching to them based on tensor type. The CPU and CUDA implementations will be updated to have process group select its CPU and CUDA backends respectively.

Differential Revision: [D39506979](https://our.internmc.facebook.com/intern/diff/D39506979)

[ghstack-poisoned]
@H-Huang
Copy link
Member Author

H-Huang commented Sep 28, 2022

@H-Huang has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@H-Huang
Copy link
Member Author

H-Huang commented Sep 28, 2022

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

@pytorchbot successfully started a merge job. Check the current status here and land check progress here.
The merge job was triggered with the land checks (-l) flag. If you did not specify this flag yourself, you are likely enrolled in the land checks rollout. This means that your change will be merged once all checks on your PR and the land checks have passed (ETA 4 Hours). If you need to coordinate lands between different changes and cannot risk a land race, please add the ciflow/trunk label to your PR and wait for signal to complete, and then land your changes in proper order. Having trunk, pull, and Lint pre-run on a PR will bypass land checks and the ETA should be immediate. 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 pushed a commit that referenced this pull request Sep 28, 2022
…mplementations (#83810)

### About this PR
* Update the all_reduce op to dispatch to cpu and cuda implementations. Right now they both perform the same logic so this is essentially a no-op.
* Update test to validate that a separate device implementation is not supported.

### About this stack
In the future we will repurpose ProcessGroup to instead contain a list of Backends (ProcessGroupNCCL/Gloo/UCC) and perform dispatching to them based on tensor type. The CPU and CUDA implementations will be updated to have process group select its CPU and CUDA backends respectively.

Differential Revision: [D39506979](https://our.internmc.facebook.com/intern/diff/D39506979)
Pull Request resolved: #83810
Approved by: https://github.com/kwen2501
drisspg pushed a commit to drisspg/pytorch that referenced this pull request Sep 29, 2022
…mplementations (pytorch#83810)

### About this PR
* Update the all_reduce op to dispatch to cpu and cuda implementations. Right now they both perform the same logic so this is essentially a no-op.
* Update test to validate that a separate device implementation is not supported.

### About this stack
In the future we will repurpose ProcessGroup to instead contain a list of Backends (ProcessGroupNCCL/Gloo/UCC) and perform dispatching to them based on tensor type. The CPU and CUDA implementations will be updated to have process group select its CPU and CUDA backends respectively.

Differential Revision: [D39506979](https://our.internmc.facebook.com/intern/diff/D39506979)
Pull Request resolved: pytorch#83810
Approved by: https://github.com/kwen2501
@facebook-github-bot facebook-github-bot deleted the gh/H-Huang/76/head branch October 1, 2022 14:19
mehtanirav pushed a commit that referenced this pull request Oct 4, 2022
…mplementations (#83810)

### About this PR
* Update the all_reduce op to dispatch to cpu and cuda implementations. Right now they both perform the same logic so this is essentially a no-op.
* Update test to validate that a separate device implementation is not supported.

### About this stack
In the future we will repurpose ProcessGroup to instead contain a list of Backends (ProcessGroupNCCL/Gloo/UCC) and perform dispatching to them based on tensor type. The CPU and CUDA implementations will be updated to have process group select its CPU and CUDA backends respectively.

Differential Revision: [D39506979](https://our.internmc.facebook.com/intern/diff/D39506979)
Pull Request resolved: #83810
Approved by: https://github.com/kwen2501
alvgaona pushed a commit to alvgaona/pytorch that referenced this pull request Oct 11, 2022
…mplementations (pytorch#83810)

### About this PR
* Update the all_reduce op to dispatch to cpu and cuda implementations. Right now they both perform the same logic so this is essentially a no-op.
* Update test to validate that a separate device implementation is not supported.

### About this stack
In the future we will repurpose ProcessGroup to instead contain a list of Backends (ProcessGroupNCCL/Gloo/UCC) and perform dispatching to them based on tensor type. The CPU and CUDA implementations will be updated to have process group select its CPU and CUDA backends respectively.

Differential Revision: [D39506979](https://our.internmc.facebook.com/intern/diff/D39506979)
Pull Request resolved: pytorch#83810
Approved by: https://github.com/kwen2501
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed Merged module: c10d Issues/PRs related to collective communications and process groups oncall: distributed Add this issue/PR to distributed oncall triage queue release notes: distributed (c10d) release notes category topic: new features topic category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants