Skip to content

Commit

Permalink
Fix training for single GPU
Browse files Browse the repository at this point in the history
  • Loading branch information
adamoudad committed Nov 29, 2020
1 parent 5f18337 commit 7b6c6c5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@

# switch output device to: gpu-1 ~ gpu-n
sw_start = time.time()
mt.output_device = idx % (torch.cuda.device_count() -1) + 1
if torch.cuda.device_count() > 1:
mt.output_device = idx % (torch.cuda.device_count() -1) + 1
sw_end = time.time()
if config.debug:
print('output switch time: {}'.format(sw_end - sw_start) )
Expand Down

0 comments on commit 7b6c6c5

Please sign in to comment.