Skip to content

Commit c3522e8

Browse files
four4fishawaelchli
andauthored
Apply suggestions from code review
Co-authored-by: Adrian Wälchli <[email protected]>
1 parent 16563f7 commit c3522e8

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

pytorch_lightning/plugins/collective/horovod_collective.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ def __init__(
3232
self,
3333
on_gpu: Optional[bool] = False,
3434
local_rank: int = 0,
35-
):
35+
) -> None:
3636
self.on_gpu = on_gpu
3737
self.local_rank = local_rank
3838

3939
def join(self) -> None:
4040
"""Horovod function that indicates that the rank finished processing data.
4141
42-
All ranks that did not call join() continue to process allreduce operations. This function blocks Python thread
42+
All ranks that did not call join() continue to process allreduce operations. This function blocks the Python thread
4343
until all ranks join.
4444
"""
4545
if self.on_gpu:

pytorch_lightning/plugins/collective/torch_collective.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ def __init__(
3636
device: Optional[Union[str, torch.device]] = torch.device("cpu"),
3737
device_id: Optional[int] = None,
3838
world_size: int = 1,
39-
):
40-
""".. note::
41-
42-
DDP and DDPSpawn sync accross multiple nodes/devices, local_reduce = False
43-
DP run reduce in on node, local_reduce = True
44-
DDP2 behaves like DP in one node, local_reduce = True
39+
) -> None:
40+
"""
41+
Note:
42+
DDP and DDPSpawn sync accross multiple nodes/devices, local_reduce = False
43+
DP run reduce in on node, local_reduce = True
44+
DDP2 behaves like DP in one node, local_reduce = True
4545
4646
local_reduce set in Plugins.setup() functions
4747
"""
@@ -84,6 +84,7 @@ def reduce(
8484
If local_reduce = True (dp and ddp2), reduces tensor from all local processes.
8585
8686
If local_reduce = False (ddp, ddpspawning and extentions), reduces a tensor from several distributed processes
87+
8788
Args:
8889
tensor: the tensor to sync and reduce
8990
group: the process group to gather results from. Defaults to all processes (world)

0 commit comments

Comments
 (0)