dotnet/TorchSharp

multi-gpu training

lindadamama opened this issue · 2 comments

Does it support multi-gpu training? Is there any sample code?

var gpu0 = new Device(DeviceType.CUDA, 0);
var gpu1 = new Device(DeviceType.CUDA, 1);

var myTensor0 = torch.ones(3, 3).to(gpu0);
var myTensor1 = torch.ones(3, 3).to(gpu1);

...

I think this should work.

It should, but I haven't tested it myself.