RuntimeError:: CUDA error: no kernel image is available for execution on the device

Should I reinstall the new version of pytorch?
In the previous block, there was an error that Pytorch and CUDA did not match, so I solved it by installing’cudetoolkit’. Is the title error a separate issue?

The error is raised, if your current PyTorch build doesn’t support your GPU architecture. E.g. the current PyTorch binaries are built for sm>=3.7, so for older architectures you would have to build from source.

Device name - GeForce GT 730
Device capability - (3,5)
Pytorch version - 1.13.0/1.12.1+cu113/1.12.0

According to pytorch_compute_capabilities/table.md at main · moi90/pytorch_compute_capabilities · GitHub and Previous PyTorch Versions | PyTorch I have tried several different versions of pytorch using pip and conda. None worked. All have the same “kernel error”. I haven’t managed to figure out where it comes from.

If I understand correctly, conda’s 1.12.1+cu113 should work just fine (in comparison to pip), but it still have the same error.

Command to reproduce:

/tmp $ CUDA_LAUNCH_BLOCKING=1 python 
Python 3.10.8 (main, Nov 20 2022, 21:32:29) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.zeros(1).cuda()
/tmp/venv/lib/python3.10/site-packages/torch/cuda/__init__.py:123: UserWarning: 
    Found GPU0 NVIDIA GeForce GT 730 which is of cuda capability 3.5.
    PyTorch no longer supports this GPU because it is too old.
    The minimum cuda capability supported by this library is 3.7.
    
  warnings.warn(old_gpu_warn % (d, name, major, minor, min_arch // 10, min_arch % 10))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/tmp/venv/lib/python3.10/site-packages/torch/_tensor.py", line 338, in __repr__
    return torch._tensor_str._str(self, tensor_contents=tensor_contents)
  File "/tmp/venv/lib/python3.10/site-packages/torch/_tensor_str.py", line 481, in _str
    return _str_intern(self, tensor_contents=tensor_contents)
  File "/tmp/venv/lib/python3.10/site-packages/torch/_tensor_str.py", line 447, in _str_intern
    tensor_str = _tensor_str(self, indent)
  File "/tmp/venv/lib/python3.10/site-packages/torch/_tensor_str.py", line 270, in _tensor_str
    formatter = _Formatter(get_summarized_data(self) if summarize else self)
  File "/tmp/venv/lib/python3.10/site-packages/torch/_tensor_str.py", line 103, in __init__
    nonzero_finite_vals = torch.masked_select(tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0))
RuntimeError: CUDA error: no kernel image is available for execution on the device

I have tried pycuda to verify that cuda works. I had to reinstall cuda toolkit with profile flag but it worked after that.

I have tied to emerge gentoo’s pytorch package, but I’m getting “internal compiler error”.

Am I missing something? If conda’s 1.12.1 with cudu 113 didn’t work, will build from source change anything at all?

No, since both binaries are built for compute capability >= 3.7 as indicated in the error message:

    Found GPU0 NVIDIA GeForce GT 730 which is of cuda capability 3.5.
    PyTorch no longer supports this GPU because it is too old.
    The minimum cuda capability supported by this library is 3.7.

Building from source might work if you use TORCH_CUDA_ARCH_LIST=3.5 python setup.py install (we also had a few discussions about source builds for old GPU architectures in this forum, so you might want to search for some in case you get stuck).

Can I build master branch/v1.13.0 or I have to use older pytorch version?