YOLOP icon indicating copy to clipboard operation
YOLOP copied to clipboard

Is it wrong for multiple gpus: "return torch.device('cuda:0' if cuda else 'cpu')"

Open farhad-dalirani opened this issue 4 years ago • 1 comments

Hello,

I found this code:

"return torch.device('cuda:0' if cuda else 'cpu')" at the end of select_device function in utils.py.

Is it wrong for multiple GPU systems?

farhad-dalirani avatar Oct 26 '21 23:10 farhad-dalirani

If you are running in multiple GPUs, I can see that it works fine. However, if you have multiple GPUs and you want to use a specific one, e.g. cuda:1 you will get the following error RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cuda:1!

So, this should be changed accordingly to the desired GPU id.

kosmastsk avatar Jun 20 '22 17:06 kosmastsk