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

111464: <p>Should I reinstall the new version of pytorch?<br>
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?</p>

ptrblck: <p>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&gt;=3.7, so for older architectures you would have to build from source.</p>

koutoftimer: <p>Device name - GeForce GT 730<br>
Device capability - (3,5)<br>
Pytorch version - 1.13.0/1.12.1+cu113/1.12.0</p>
<p>According to <a href="https://github.com/moi90/pytorch_compute_capabilities/blob/main/table.md" class="inline-onebox" rel="noopener nofollow ugc">pytorch_compute_capabilities/table.md at main · moi90/pytorch_compute_capabilities · GitHub</a> and <a href="https://pytorch.org/get-started/previous-versions/" class="inline-onebox" rel="noopener nofollow ugc">Previous PyTorch Versions | PyTorch</a> 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.</p>
<p>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.</p>
<p>Command to reproduce:</p>
<pre data-code-wrap="console"><code class="lang-nohighlight">/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.
&gt;&gt;&gt; import torch
&gt;&gt;&gt; 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 "&lt;stdin&gt;", line 1, in &lt;module&gt;
  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) &amp; tensor_view.ne(0))
RuntimeError: CUDA error: no kernel image is available for execution on the device
</code></pre>
<p>I have tried pycuda to verify that cuda works. I had to reinstall cuda toolkit with profile flag but it worked after that.</p>
<p>I have tied to emerge gentoo’s pytorch package, but I’m getting “internal compiler error”.</p>
<p>Am I missing something? If conda’s 1.12.1 with cudu 113 didn’t work, will build from source change anything at all?</p>

ptrblck: <aside class="quote no-group" data-username="koutoftimer" data-post="3" data-topic="111846">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/koutoftimer/48/55441_2.png" class="avatar"> koutoftimer:</div>
<blockquote>
<p>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.</p>
</blockquote>
</aside>
<p>No, since both binaries are built for compute capability &gt;= 3.7 as indicated in the error message:</p>
<pre data-code-wrap="python"><code class="lang-python">    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.
</code></pre>
<p>Building from source might work if you use <code>TORCH_CUDA_ARCH_LIST=3.5 python setup.py install</code> (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).</p>

koutoftimer: <p>Can I build master branch/v1.13.0 or I have to use older pytorch version?</p>