Manoj Mano Manoj Mano - 1 year ago 207
Python Question

How to run torch program on two GPU parallel?

I want to run a python torch code in two parallel GPUs to reduce my training time. But I can't run the two GPUs at a time.


OS: ubuntu 16.04

Gpu : Nvidia geforce (4gb each)


New to Gpu ,Correct me if I wrong.

Thanks in advance :)

Answer Source

Try This:

net = torch.nn.DataParallel(model, device_ids=[0, 1, 2])
output = net(input_var)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download