How to activate GPU in tensorflow

Hi all,
i have meet a problem that i cannot activate tensorflow by GPU.
tf.config.list_physical_devices(‘GPU’) = [ ]

the version of tool and softare Condition as below

  1. Nvidia Geforce RTX 3060Ti
  2. Hardware driver: 531.79
  3. Python: 3.9.16
  4. tensorflow:2.11.0
  5. Cuda: 12.1
  6. cuDNN: major 8/minor 2/patchlevel 1

whether those version is not compatible, if the version is compatiable,
can someone share the install process?
thanks

1 Like

@Alex_Lin,

Welcome to the Tensorflow Forum!

According to tested build configurations CUDA 11.2 is compatible with Tensorflow 2.11.

Once Tensorflow has been installed, you can verify the GPU setup as shown below

import tensorflow as tf
print(tf.config.list_physical_devices('GPU'))

For step by step instructions please refer to Установите TensorFlow с помощью pip.

Thank you!

For some reason the bottom link appears to me in (what looks like) Russian? Установите TensorFlow с помощью pip.

By the way, the explanations in that url are crystal clear. Thank you

I think -since OP uses tf 2.11- that the cuda version that should work is 11.2 rather than 12:

Version Python version Compiler Build tools cuDNN CUDA
tensorflow-2.12.0 3.8-3.11 GCC 9.3.1 Bazel 5.3.0 8.6 11.8
tensorflow-2.11.0 3.7-3.10 GCC 9.3.1 Bazel 5.3.0 8.1 11.2
tensorflow-2.10.0 3.7-3.10 GCC 9.3.1 Bazel 5.1.1 8.1 11.2

Source

@Alex_Lin

Hi chunduriv
thanks for your replying,
but i use windows 11, not sure whether CUDA 11.2 is able to support windows11.
because i check the cuda 11.2 only have windows 10 driver.
is it any chance to use the lastest tensorflow version to cover Cuda 12.1 and cuDNN 8.2.1 ?

@Alex_Lin,

but i use windows 11, not sure whether CUDA 11.2 is able to support windows11.

CUDA 11.2 is officially supported on Windows 10. However, it can also be installed and used on Windows 11.

is it any chance to use the lastest tensorflow version to cover Cuda 12.1 and cuDNN 8.2.1 ?

No, the latest stable version of TF 2.12 is compatible with CUDA 11.8 and cuDNN 8.6 exclusively on Ubuntu. However, if you are using windows you will need to install Tensorflow in WSL2.

Thank you!

1 Like

Hi,
I need assistance in configuring TensorFlow for GPU usage on a remote computer running Windows 11 with an NVIDIA RTX 3060. Despite my attempts, I haven’t been successful in recognizing the GPU in Jupyter Notebook. Could you guide me on the correct versions of TensorFlow, CUDA, cuDNN, and the necessary steps for GPU utilization?