How to validate a neural network on another GPU?

Hello!
I have two video cards and I want to train a neural network on one video card, and after each epoch to test it on another video card. Please tell me how it can be implemented?

Thank you in advance!

Hi @tim,

What’s the rationale behind this training architecture over the classical multi-GPU distributed training?

The framework and the underlying libraries are optimized to give you the best throughput in distributed training. You can either use torch.distributed or Horovod to achieve that, and you will certainly have a better GPU occupancy.

thank you for answer! I’m using nn.DataParallel, but I have problem: RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cuda:1

What’s your command line?

Here you can find a small tutorial explaining how to train on multiple devices and the best practices.

model = nn.DataParallel(Neural())
model = model.to(torch.device('cuda'))
images_first, images_second = (images_first.to(torch.device('cuda'), torch.float32), images_second.to(torch.device('cuda'), torch.float32))
        
output = model(images_first, images_second) <--- here I have problem