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

[16/N] Add _allgather_base custom op with CPU/CUDA implementation #88889

Closed
wants to merge 2 commits into from

Conversation

H-Huang
Copy link
Member

@H-Huang H-Huang commented Nov 11, 2022

Stack from ghstack:

Context

#86225

Differential Revision: D41227739

@pytorch-bot
Copy link

pytorch-bot bot commented Nov 11, 2022

🔗 Helpful Links

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

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

✅ No Failures

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

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

&::c10d::ProcessGroup::_allgather_base,
[](const c10::intrusive_ptr<::c10d::ProcessGroup>& self,
at::Tensor& output_tensor,
at::Tensor& input_tensor,
Copy link
Member Author

@H-Huang H-Huang Nov 11, 2022

Choose a reason for hiding this comment

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

i think input_tensor can be const &

Copy link
Contributor

Choose a reason for hiding this comment

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

I had a look at init.cpp, it seems the convention has not been using const. Not sure why. Can go with convention I guess.

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.

&::c10d::ProcessGroup::_allgather_base,
[](const c10::intrusive_ptr<::c10d::ProcessGroup>& self,
at::Tensor& output_tensor,
at::Tensor& input_tensor,
Copy link
Contributor

Choose a reason for hiding this comment

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

I had a look at init.cpp, it seems the convention has not been using const. Not sure why. Can go with convention I guess.

device = "cuda"
tensor = torch.ones(10, 10, device=torch.device(device))
output_tensor = torch.zeros(10, 10, device=torch.device(device))
dist._all_gather_base(output_tensor, tensor)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use all_gather_into_tensor at Python level.
We will also rename _all_gather_base at the binding and C++ levels to all_gather_into_tensor when we introduce extension-breaking changes in 2.0.

Copy link
Member Author

Choose a reason for hiding this comment

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

good point! thanks

@H-Huang
Copy link
Member Author

H-Huang commented Nov 11, 2022

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

@H-Huang H-Huang added the ciflow/trunk Trigger trunk jobs on your pull request label Nov 12, 2022
@H-Huang
Copy link
Member Author

H-Huang commented Nov 12, 2022

@pytorchbot merge

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

kulinseth pushed a commit to kulinseth/pytorch that referenced this pull request Dec 10, 2022
@facebook-github-bot facebook-github-bot deleted the gh/H-Huang/94/head branch June 8, 2023 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk Trigger trunk jobs on your pull request Merged release notes: distributed (c10d) release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants