torch is unable to detect cuda for driver 470.182.03

username: Mahesh_Sinha
cooked: <h1><a name="describe-the-bug-1" class="anchor" href="#describe-the-bug-1"></a>Describe the bug</h1>
<p>torch (2.1.1+cu121) is unable to detect Cuda for driver 470.182.03</p>
<pre data-code-wrap="python"><code class="lang-python">import torch
torch.cuda.is_available()
</code></pre>
<p>output:</p>
<pre><code class="lang-auto">/home/ml/virtualenv/lib/python3.10/site-packages/torch/cuda/__init__.py:138: UserWarning: CUDA initialization: CUDA unknown error - this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at ../c10/cuda/CUDAFunctions.cpp:108.)
  return torch._C._cuda_getDeviceCount() &gt; 0
False
</code></pre>
<p>Expected output:</p>
<pre><code class="lang-auto">True
</code></pre>
<h1><a name="versions-2" class="anchor" href="#versions-2"></a>Versions</h1>
<p>torch – 2.0.1+cu117<br>
CUDA Version – 12.1<br>
Driver Version – 470.182.03</p>
<p>nvidia-smi output:</p>
<pre><code class="lang-auto">+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.182.03   Driver Version: 470.182.03   CUDA Version: 12.1     |
|-------------------------------+----------------------+----------------------+
| 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 A10G         On   | 00000000:00:1B.0 Off |                    0 |
|  0%   16C    P8    15W / 300W |      0MiB / 22731MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+
</code></pre>
<p>Can someone please advice ?</p>

username: ptrblck
cooked: <p>Your NVIDIA driver is too old for CUDA 12.x unless you explicitly enabled CUDA’s forward compatibility.<br>
Update the driver and it should work.</p>

username: Mahesh_Sinha
cooked: <p>Thanks <a class="mention" href="/u/ptrblck">@ptrblck</a> for quick check on this.</p>
<p>I have explicitly enabled the Cuda forward compatibility. But still it’s same.</p>

username: ptrblck
cooked: <p>If you depend on forward compatibility, you could use the <a href="https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch">NGC containers</a> as they support it and manually enabling it might not always be trivial.</p>