Error in loading tensor/model/input to CUDA

I am getting the following error:

import torch
torch.randn(3,3).to(““cuda”)
File “”, line 1
torch.randn(3,3).to(”“cuda”)
^
SyntaxError: unterminated string literal (detected at line 1)
torch.randn(3,3).to(“cuda”)
Traceback (most recent call last):
File “”, line 1, in
RuntimeError: CUDA error: CUDA-capable device(s) is/are busy or unavailable
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
Compile with TORCH_USE_CUDA_DSA to enable device-side assertions.

torch.cuda.is_available()
True

Even though torch.cuda.is_available() is true and no other processes are running in GPU as shown in nvidia-smi

ue Dec 17 10:07:21 2024
±----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.127.05 Driver Version: 550.127.05 CUDA Version: 12.4 |
|-----------------------------------------±-----------------------±---------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA A10-24Q On | 00000002:00:00.0 Off | 0 |
| N/A N/A P8 N/A / N/A | 1MiB / 24512MiB | 0% Default |
| | | N/A |
±----------------------------------------±-----------------------±---------------------+

±----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
±----------------------------------------------------------------------------------------+

Your setup seems to have issues communicating with your GPU. Cou could build any CUDA Sample, execute it, and would most likely see the same issue.
I don’t know if this setups worked before or not, but you could try to e.g. reinstall the driver.

Thank you, this setup hasnt worked before. This is a vGPU. I am unable to reset it too.

I don’t know if you might run into the same issue, but check out this topic which had similar issues accessing the vGPU.

Strange error but it is showing a typo in the code first:

torch.randn(3,3).to(”“cuda”)
^
SyntaxError: unterminated string literal (detected at line 1)
torch.randn(3,3).to(“cuda”)
Traceback (most recent call last):
File “”, line 1, in

PS: Just got now that this is the python runtime environment and those are executions within.

It formatted it very oddly because the >>> means quote block in markdown.

The typo is in ""cuda" (note the two " on the left).

1 Like

Yes, I noticed that, that was the first trial . I clearly pasted the corrected commad later.

1 Like