Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion torch/testing/_internal/distributed/distributed_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,11 @@ def _init_multigpu_helper(self):
if BACKEND == "nccl":
apply_hack_for_nccl()

nGPUs_per_process = nGPUs // world_size
# If rank is lesser than or equal to number of available GPU's
# then each rank can be mapped to corresponding GPU.
nGPUs_per_process = 1
if world_size > nGPUs:
nGPUs_per_process = nGPUs // world_size
rank_to_GPU = {
i: list(
visible_devices[i * nGPUs_per_process: (i + 1) * nGPUs_per_process]
Expand Down