Skip to content

Commit 4f5837b

Browse files
authored
Fix ManagedProcessGroup when used in c10d APIs (#191)
1 parent 24b2ae8 commit 4f5837b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

torchft/process_group.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,10 +1026,11 @@ def __init__(self, manager: "Manager", work: Work, default_result: object) -> No
10261026

10271027
def wait(self, timeout: Optional[timedelta] = None) -> bool:
10281028
try:
1029-
if timeout is not None:
1030-
self._work.wait(timeout)
1031-
else:
1032-
self._work.wait()
1029+
if self._work is not None:
1030+
if timeout is not None:
1031+
self._work.wait(timeout)
1032+
else:
1033+
self._work.wait()
10331034
except Exception as e:
10341035
self._manager.report_error(e)
10351036

@@ -1064,7 +1065,6 @@ def allreduce(self, tensors: List[torch.Tensor], opts: object) -> Work:
10641065

10651066
if self._manager.errored() is not None:
10661067
return _DummyWork(tensors)
1067-
10681068
try:
10691069
work = super().allreduce(tensors, opts)
10701070
except Exception as e:

0 commit comments

Comments
 (0)