-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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 descriptions to accelerator broadcast function/clean up all_gather #6044
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -383,12 +383,18 @@ def barrier(self, name: Optional[str] = None) -> None: | |
self.training_type_plugin.barrier(name=name) | ||
|
||
def broadcast(self, obj: object, src: int = 0) -> object: | ||
"""Broadcasts an object to all processes""" | ||
"""Broadcasts an object to all processes, such that the src object is broadcast to all other ranks if needed. | ||
|
||
Args: | ||
obj: Object to broadcast to all process, usually a tensor or collection of tensors. | ||
src: The source rank of which the object will be broadcast from (Default: 0) | ||
SeanNaren marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
return self.training_type_plugin.broadcast(obj, src) | ||
|
||
def all_gather(self, tensor: Union[torch.Tensor], group: Optional[Any] = None, sync_grads: bool = False): | ||
""" | ||
Function to gather a tensor from several distributed processes | ||
Function to gather a tensor from several distributed processes. | ||
|
||
Args: | ||
tensor: tensor of shape (batch, ...) | ||
group: the process group to gather results from. Defaults to all processes (world) | ||
|
@@ -409,7 +415,7 @@ def process_dataloader(self, dataloader: Union[Iterable, DataLoader]) -> Union[I | |
@property | ||
def results(self) -> Any: | ||
""" | ||
The results of the last training/testing run will be cached here. | ||
The results of the last training/testing run will be cached within the training type plugin. | ||
In distributed training, we make sure to transfer the results to the appropriate master process. | ||
""" | ||
# TODO: improve these docs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Improved enough already to remove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like rando todos, so let me remove it :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my comment, but I don't remember what I wanted to improve 🤣 |
||
|
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.
shall we then rather call
source_rank
?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.
Its called source in the lower level pytorch call that is commonly used outside of TPU/some training type plugin:
https://pytorch.org/docs/stable/distributed.html#torch.distributed.broadcast
So I think it might be alright to keep it as is!
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.
I vote for keep :)