Installing Tensorflow on windows with GPU

I need help in installing tensorflow with gpu on windows.

I installed Nvidia Drivers, Cuda Toolkit 12.3, CudaNN 8.9, TensorRT. However, tensorflow is still showing 0 devices for gpu

Hi @HamzaJomaa

Welcome to the TensorFlow Forum!

You are facing this issue because TensorFlow > 2.10 is not supported on Windows OS. Please have a look at the below statement and follow this tested build configuration for the supported version of libraries for GPU setup.

GPU support on native-Windows is only available for 2.10 or earlier versions, starting in TF 2.11, CUDA build is not supported for Windows. For using TensorFlow GPU on Windows, you will need to build/install TensorFlow in WSL2 or use tensorflow-cpu with TensorFlow-DirectML-Plugin

You may need to either install the older version of TensorFlow ‘2.10’ or earlier version along with the compatible Python, CUDA, cuDNN as mentioned in the above link or you can install WSL2 to have GPU support enabled in your system. Thank you

Are people able to install TF>2.10 on WSL2? I tried a few times and all failed. So I am still running TF2.8 on Windows 11.

I followed the instructions for installing TF on WSL2, but received the following error messages. Can someone please advise what to do next?

(base) dlin@SCL-DLIN:~$ conda activate tf2
(tf2) dlin@SCL-DLIN:~$ python3 -c “import tensorflow as tf; print(tf.config.list_physical_devices(‘GPU’))”
2024-04-03 20:36:46.136020: I tensorflow/core/util/] 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-04-03 20:36:46.166472: I tensorflow/core/platform/] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-04-03 20:36:46.551590: W tensorflow/compiler/tf2tensorrt/utils/] TF-TRT Warning: Could not find TensorRT
2024-04-03 20:36:46.972529: E external/local_xla/xla/stream_executor/cuda/] failed call to cuInit: UNKNOWN ERROR (100)