If you would like to use data parallel, you could simply warp your model to nn.DataParallel or nn.DistributedDataParallel. Have a look at this tutorial for more information.
What if I have to sub-models, say model1 and model2. Do I need to write as follows?
model1 = nn.DataParallel(model1)
model2 = nn.DataParallel(model2)
…
…
If both submodules are registered into the same parent module, you could call nn.DataParallel just on the panel. If not, then your approach should work.