Cuda issue : RuntimeError: CUDA error: invalid device ordinal
Opened this issue · 1 comments
nathanetourneau commented
In your code, the GPU you are using is named "cuda:1", but this fails on some computers.
For instance, on my computer, this dummy piece of code fails :
import torch
device = torch.device("cuda:1")
a = torch.tensor([1, 2, 3])
a.to(device) # Fails
The error is
RuntimeError: CUDA error: invalid device ordinal
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1
I had the same error with this repository, and I fixed this error by replacing all occurences of "cuda:1" to "cuda:0"
The files involved are:
xxxxibo commented
Hi, I'm having the same problem as you and would like to ask about your version of cuda and pytorch to run the code?