So,
There are two options:

You want to run independent process en each GPU (like two training pipes in parallel or so).
You want to use several gpus to train a single experiment.

I think you are asking for the case 2.
Soo there are two options in here. The easiest one is using a cuda environment variable.
CUDA_VISIBLE_DEVICES
This enviroment variable can be used for any process in your OS. What it does is masking the devices such that the called process can only see the gpus that you allow.
Example:
CUDA_VISIBLE_DEVICES=7,8 python3 run_exp.py
Another option is letting the process to see the 8 gpus and choose which ones you want to parallelize over.
The syntax of dataparallel is:
torch.nn.DataParallel(module, device_ids=None, output_device=None, dim=0)

You can pass device_ids=[7,8]
The former case is preferred since there is less chance you mess it up.
Note that when you call cuda_visible_devices=7,8, pytorch will only see two gpus.
Thus the indices for those will be (inside python) 0,1 instead of 7,8
In short this module automatically allocates your inputs to the model splitting the batch in as many chunks as gpus you have chosen.
So you don’t really need to take care of allocating them. You just need to ensure that everything inside your nn.Module has been written soft-coding devices. This is, if you need to create a tensor of zeros,
you do something like
var=torch.zeros(10).to(input.device)
instead of
vcar=torch.zeros(10).cuda()