GPU is not detected in Tensorflow

51 Views Asked by At

I am using Tensorflow on Windows, and I am trying to use my GPU. But Tensorflow seems unable to detect my GPU.

I created a Python virtual environment and installed Python (3.8) and TensorFlow. My environment is:

  • NVIDIA GeForce RTX 3080 GPUs (10+10)
  • Processor: Intel Xeon Gold 6348 CPU @ 2,60GHz, 3.50GHz
  • RAM: 512 GB
  • NVIDIA driver version=511.65
  • CUDA Version: 11.6 Cudnn: 9.0.0 (I think it is wrong, I need to downgrade it to 8.9?)
  • Microsoft Visual Studio 2019

When I type

>nvidia-smi

>nvcc-V 

both work. However, when I try to use:

print("Num GPUs Available: ", 
    len(tf.config.experimental.list_physical_devices('GPU')))

I get the output:

Num GPUs Available: 0

I do not understand. Also, the link does not provide updated Cuda and Python versions in Windows. Do I need to downgrade everything? Cuda and drivers as well? How do I fix it?

Even after downgrading the NVIDIA drivers and CUDA to 460.82 and 11.2 *(This failed; it says it is not compatible, had to install 11.6 again) (according to this) it does not work.

What else can I do?

1

There are 1 best solutions below

0
Ian Boyd On

Tensorflow no longer supports GPUs

Tensorflow no longer supports GPU on Windows: archive:

From the Tensorflow web-site:

Caution: TensorFlow 2.10 was the last TensorFlow release that supported GPU on native-Windows. Starting with TensorFlow 2.11, you will need to install TensorFlow in WSL2, or install tensorflow-cpu and, optionally, try the TensorFlow-DirectML-Plugin

You can install the older version using:

>pip install tensorflow==2.10

The idea was that they were tired of supporting GPUs and CUDA, so they created a version of Tensorflow that supports "plugins". This way different hardware manufacturers could supply their own plugin.

Microsoft DirectML plugin for Tensorflow

In 2021, Microsoft created a Tensorflow plugin that allows you to use any DirectML-compatible GPU or hardware device:

This way you could use your GPU with Tensorflow again.

Microsoft abandoned DirectML plugin

On October 24, 2023, Microsoft abandoned DirectML:

Tensorflow no longer runs on Windows, and cannot be used by Windows users.