GPU requires CUDA evrsion which installed but gives an error

Ilya_Kotlov: <p>This is part is just a tracking on the issue which I though I solved (but actually I didn’t), see the final question in the end.</p>
<p>part 1:<br>
using torch 0.3.0 by installing <code>torch-0.3.0.post4-cp27-cp27mu-linux_x86_64.whl</code> from <code>https://download.pytorch.org/whl/cu80/torch_stable.html</code></p>
<pre><code class="lang-auto">Found GPU0 NVIDIA GeForce RTX 2080 Ti which requires CUDA_VERSION &gt;= 8000 for
     optimal performance and fast startup time, but your PyTorch was compiled
     with CUDA_VERSION 8000. Please install the correct PyTorch binary
     using instructions from http://pytorch.org
</code></pre>
<p>Is that a bug ? It says &gt;= 8000 and says the actual version is 8000, that kinda fit.</p>
<p>Well with torch 3.1 it says:</p>
<pre><code class="lang-auto">/usr/local/lib/python2.7/site-packages/torch/cuda/__init__.py:95: UserWarning: 
    Found GPU0 NVIDIA GeForce RTX 2080 Ti which requires CUDA_VERSION &gt;= 9000 for
     optimal performance and fast startup time, but your PyTorch was compiled
     with CUDA_VERSION 8000. Please install the correct PyTorch binary
     using instructions from http://pytorch.org
    
  warnings.warn(incorrect_binary_warn % (d, name, 9000, CUDA_VERSION))

</code></pre>
<p>So I guess it is a an old bug that was fixed.</p>
<p>I’m asking those in the context of a code which should run with torch 0.2.0, but I faced this <a href="https://discuss.pytorch.org/t/using-cuda-is-very-slow-on-pytorch-0-2-0/18662">issue 18622</a> and trying different torch versions to see if anyone can fit.</p>
<p>torch 0.4.0 behaves like torch 0.2.0 and like torch 0.3.x, it takes a couple of minute on the operator .cuda and then outputs the error.</p>
<p>part 2:<br>
I figured it out that CUDA supports my GPU only from CUDA9.0 versions and above, so no workarounds for that part.<br>
It seems that I should change my container for cuda9, but strangely I found that with the same container if I download any version of torch for cu9, tried both 0.3.0 and 1.0.0, then .cuda() runs much faster, but I didn’t installed on the container any cuda 9.0 drivers, in the path of cuda in the versions files it still shows that the version is 8 and on the host it is cuda11, but print <code>torch.version.cuda shows</code> 9 version. How this is possible and why does it work ?</p>
<pre><code class="lang-auto">root@2023553b1d7e:/# cat /usr/local/cuda/version.txt
CUDA Version 8.0.61
root@2023553b1d7e:/# cat /usr/local/cuda-8.0/version.txt
CUDA Version 8.0.61
root@2023553b1d7e:/# 

</code></pre>
<p>there is no way cuda 9 is on the container because it is:<br>
<code>nvidia/cuda:8.0-cudnn7-devel-ubuntu16.04</code></p>
<p>I install the torch 0.3.0 from the wheel <code>torch-0.3.0.post4-cp27-cp27mu-linux_x86_64.whl</code> from the <code>cu9</code> storage on pytorch site, does it include somewhere in it the cuda9 which it prints, is it builtin (that would explain it perhaps) ?</p>
<p>Hm, just faced an error like this during a convolution:</p>
<pre><code class="lang-auto">RuntimeError: CUDNN_STATUS_EXECUTION_FAILED
</code></pre>
<p>Seems like it isn’t actually working without the right cuda drive on the container, so I’ll try the right container and will update on the issue.</p>
<p>Same error with the container <code>9.0-cudnn7-devel-ubuntu16.04</code>.<br>
The version of cuda driver for this time is 9.0 as it said by inspecting cuda and cuda-9.0 folders and their version.txt files.</p>
<p>the full error log is:</p>
<pre><code class="lang-auto">Traceback (most recent call last):
  File "/opt/.pycharm_helpers/pydev/pydevd.py", line 1496, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/opt/project/script_pwc.py", line 72, in &lt;module&gt;
    flo = net(im_all)
  File "/usr/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 325, in __call__
    result = self.forward(*input, **kwargs)
  File "/opt/project/models/PWCNet.py", line 189, in forward
    c11 = self.conv1b(self.conv1aa(self.conv1a(im1)))
  File "/usr/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 325, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/torch/nn/modules/container.py", line 67, in forward
    input = module(input)
  File "/usr/local/lib/python2.7/site-packages/torch/nn/modules/module.py", line 325, in __call__
    result = self.forward(*input, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/torch/nn/modules/conv.py", line 277, in forward
    self.padding, self.dilation, self.groups)
  File "/usr/local/lib/python2.7/site-packages/torch/nn/functional.py", line 90, in conv2d
    return f(input, weight, bias)
RuntimeError: CUDNN_STATUS_EXECUTION_FAILED
</code></pre>
<p>The <code>torch.version.cuda</code> is the same as the version in <code>version.txt</code> which is 9.</p>
<p>This works with the cuda8 container and torch 0.2.0 (just the slow problem).</p>
<p>Why this upgrade didn’t work ?<br>
It is just a convolution code that falls, not anything unique to the code itself.</p>
<p>Meanwhile I checked the exact <code>cudnn version</code> was installed on this container and it is <code>7.6.4</code> while the cuda is <code>CUDA 9.0.176</code> as was said, and they are compatible looking at the <a href="https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn_764/cudnn-support-matrix/index.html" rel="noopener nofollow ugc">nvidia site</a></p>
<p>Well, in conclusion, on 0.2.0 The execution of the code, particularly the forward of the convolution works, with slow start (about 15-20 minutes for .cuda and one forward of deep network), but the question is still why it fails with cuda9.0 and torch 0.3.0   with <code>CUDNN_STATUS_EXECUTION_FAILED</code> ?</p>
<p>Just found that message from <code>soumith</code> in <a href="https://github.com/pytorch/pytorch/issues/17543" rel="noopener nofollow ugc">github issue</a>:</p>
<pre><code class="lang-auto">CUDA 9 and RTX 2080 Ti simply aren't compatible and dont play well togethere.
An older CuDNN version working is likely a side-effect rather than expectation.
Use CUDA10 and CUDA10 versions of CuDNN etc. for RTX 2080 which is Turing architecture
</code></pre>
<p>Must be it.</p>

Ilya_Kotlov: <p>Well, <a href="https://stackoverflow.com/questions/69338497/how-to-install-pytorch-0-3-on-windows-wsl-2" rel="noopener nofollow ugc">that one</a> closes the issue.</p>
<p>Just one last question, what actually happens when I run an incompatible torch 0.2.0 with cuda 8.0 and cudnn 7 on the RTX 2080 Ti (Turing) ?</p>
<p>Undefined behavior generally ? Like if it works for me even partially, I probably should be grateful.</p>
<p>I mean torch 0.2.0 with cuda8.0 with cudnn 7 on the container works (I see that the stuff is shown to be on the GPU looking on the output of .cuda() and etc.)</p>
<p>Another interesting thing that I’ve noticed now is that the authors of the code I’m trying to run used Pascal GPU with compute capability 6.x which is totally different from the compute capability for 2080 Ti, which is 7.5. Maybe the error of CUDNN is understandable in this context (with CUDA9) and the real miracle that it runs with CUDA8.</p>

ptrblck: <aside class="quote no-group" data-username="Ilya_Kotlov" data-post="1" data-topic="159097">
<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/ilya_kotlov/48/35840_2.png" class="avatar"> Ilya_Kotlov:</div>
<blockquote>
<p>if I download any version of torch for cu9, tried both 0.3.0 and 1.0.0, then .cuda() runs much faster, but I didn’t installed on the container any cuda 9.0 drivers, in the path of cuda in the versions files it still shows that the version is 8 and on the host it is cuda11, but print <code>torch.version.cuda shows</code> 9 version. How this is possible and why does it work ?</p>
</blockquote>
</aside>
<p>Most likely the binary ships with the right GPU architecture so that that CUDA toolkit will not try to jit-compile PyTorch as already described in your <a href="https://discuss.pytorch.org/t/using-cuda-is-very-slow-on-pytorch-0-2-0/18662/9">cross-post</a>.</p>
<aside class="quote no-group" data-username="Ilya_Kotlov" data-post="1" data-topic="159097">
<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/ilya_kotlov/48/35840_2.png" class="avatar"> Ilya_Kotlov:</div>
<blockquote>
<p>Hm, just faced an error like this during a convolution:</p>
<pre><code class="lang-auto">RuntimeError: CUDNN_STATUS_EXECUTION_FAILED
</code></pre>
<p>Seems like it isn’t actually working without the right cuda drive on the container, so I’ll try the right container and will update on the issue.</p>
</blockquote>
</aside>
<p>This might have been a known and already fixed issue or a completely unsupported case depending on your device you are using.<br>
Don’t use these ancient versions and upgrade to the latest PyTorch release (<code>1.12.1</code>).</p>