Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cuda issue : RuntimeError: CUDA error: invalid device ordinal #20

Open
nathanetourneau opened this issue Jul 5, 2023 · 2 comments
Open

Comments

@nathanetourneau
Copy link

nathanetourneau commented Jul 5, 2023

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
Copy link

xxxxibo commented Mar 6, 2024

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?

@VinuraD
Copy link

VinuraD commented Jan 27, 2025

Yes , changed the .toml file as a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants