Skip to content

Commit

Permalink
Update on "[C10D] Support group ranks in P2POp and batch_isend_irecv"
Browse files Browse the repository at this point in the history
Changes semantic of __repr__ of P2POp: s, d are now group ranks instead
of global ranks. I think this is OK since I also updated the field names
to make this obvious.

Also add mypy annotations

Partially addresses RFC 0042 (pytorch/rfcs#71)
See more details/motivation in #140460

cc H-Huang awgu kwen2501 wanchaol fegin fduwjj wz337 d4l3k c-p-i-o

[ghstack-poisoned]
  • Loading branch information
wconstab committed Nov 20, 2024
1 parent 0480669 commit a5b421c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions torch/distributed/distributed_c10d.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,9 @@ def __init__(
"""Init."""
self.op = op
self.tensor = tensor
self.peer = _canonicalize_group_rank(
self.group, peer, group_peer, return_global=True

Check failure on line 492 in torch/distributed/distributed_c10d.py

View workflow job for this annotation

GitHub Actions / lintrunner-noclang / linux-job

MYPY [has-type]

Cannot determine type of "group"
)
self.group = _group_or_default_group(group)
self.tag = tag
self.group_peer = _canonicalize_group_rank(self.group, peer, group_peer)
Expand Down

0 comments on commit a5b421c

Please sign in to comment.