Skip to content

Commit

Permalink
Divide args.workers by ngpus_per_node (pytorch#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
daquexian authored and soumith committed Dec 27, 2018
1 parent 44053c5 commit c5985a8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions imagenet/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ def main_worker(gpu, ngpus_per_node, args):
# DistributedDataParallel, we need to divide the batch size
# ourselves based on the total number of GPUs we have
args.batch_size = int(args.batch_size / ngpus_per_node)
args.workers = int(args.workers / ngpus_per_node)
model = torch.nn.parallel.DistributedDataParallel(model, device_ids=[args.gpu])
else:
model.cuda()
Expand Down

0 comments on commit c5985a8

Please sign in to comment.