I'm having trouble getting TensorFlow to recognize my GPU. Despite following several guides, TensorFlow still reports no GPUs available. Here are the details of my setup and the issue:
System Information:
Operating System: Windows 11 Home
GPU: NVIDIA GeForce RTX 4070 Laptop GPU
NVIDIA Driver Version: 560.81
CUDA Version: 12.6
cuDNN Version: 9.3.0
!nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Fri_Jun_14_16:44:19_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.6, V12.6.20
Build cuda_12.6.r12.6/compiler.34431801_0
!nvidia-smi
Wed Aug 14 09:18:01 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 560.81 Driver Version: 560.81 CUDA Version: 12.6 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Driver-Model | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 4070 ... WDDM | 00000000:01:00.0 Off | N/A |
| N/A 51C P3 13W / 55W | 0MiB / 8188MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+
import tensorflow as tf
2024-08-14 09:18:06.027008: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-08-14 09:18:06.960623: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
gpus = tf.config.list_physical_devices('GPU')
print("Available GPUs: ", gpus)
Available GPUs: []
I decide to seek help from my old buddy stackoverflow, we got stuck with chatgpt. Thanks to everyone
I guess this note from the TensorFlow documentation sums it up:
GPU support on native-Windows is only available for 2.10 or earlier versions
Below it you also find the compatible combinations of Python, TensorFlow, CUDA and cuDNN.
In case you absolutely need to use Windows, these are the last supported versions:
TensorFlow | Python | CUDA | cuDNN |
---|---|---|---|
tensorflow_gpu-2.10.0 | 3.10 | 11.2 | 8.1 |
As you can see, even if you correctly installed version 2.10 and not the latest version of TensorFlow, your version of CUDA and cuDNN are not supported.
So to make sure you have to correct versions set up, try these steps taken from the documentation for Windows Native:
tf
, make sure to keep it activated for the rest of the installation: conda create --name tf python=3.9
conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
pip
is up to date: pip install --upgrade pip
pip install "tensorflow<2.11"
python -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"
If you would like to use the latest version of TensorFlow, you should consinder using WSL2. Take a look here for further information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With