-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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 group
as an argument in broadcast ops
#2522
Add group
as an argument in broadcast ops
#2522
Conversation
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! Please add the type annotation and I think this PR is good to go!
@@ -86,47 +86,55 @@ def tensor_model_parallel_gather(input_: torch.Tensor, | |||
return output_tensor | |||
|
|||
|
|||
def broadcast(input_: torch.Tensor, src: int = 0): | |||
def broadcast(input_: torch.Tensor, src: int = 0, group=None): |
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.
Please add type annotation, and ditto below
def broadcast(input_: torch.Tensor, src: int = 0, group=None): | |
def broadcast(input_: torch.Tensor, src: int = 0, group: Optional[ProcessGroup] = None): |
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.
Thanks for reviewing! I committed the new changes as you suggested (with an import of the ProcessGroup
symbol).
Follow up with #2501.
Changes
In
communication_ops.py
, addgroup
as an argument in thebroadcast
auxiliary function family. This helps designate the group to communicate (for example, a designated tensor-parallel group, or pipeline-parallel group) in the future.