PyTorch's DataParallel is only using one GPU
I'm trying to use two GPU's for training a model in PyTorch. I'm using torch.nn.DataParallel but for some reason nvidia-smi is saying that I'm only using one GPU.
The code is something along the lines of:
&gt;&gt;&gt; import torch.nn as nn 
&gt;&gt;&gt; model = SomeModel()
&gt;&gt;&gt; model = nn.DataParallel(model)
&gt;&gt;&gt; model.to('cuda')

When I run the program and observe the output of nvidia-smi, I only see GPU 0 running. Would anybody know what the problem is?

You should be using nn.DataParallel(model, [0,1]) in order to use GPU #0 and GPU #1. The call model.to('cuda') afterwards is not necessary. You may be tempted to use nn.DataParallel(model.to('cuda'), [0,1]), but this appears unnecessary as well.
