It is recommended to use torch.nn.parallel.DistributedDataParallel see pointers here (Distributed Data Parallel — PyTorch master documentation 4) since DataParallel is not actively being worked on and will eventually be deprecated.
If you do want to use torch.nn.DataParallel (DataParallel — PyTorch master documentation 1) then you also need to specify the device IDs for each GPU that you want to use. For example, for two GPUs you would specify torch.nn.DataParallel(model, device_ids=[0, 1]) for cuda:0 and cuda:1, the model.to(device) is not necessary.