Bhakti
Bhakti

Reputation: 31

GPU is not detected in Tensorflow

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:

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?

Upvotes: 0

Views: 2883

Answers (1)

Ian Boyd
Ian Boyd

Reputation: 257001

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.

GitHub: Please bring back native Windows CUDA support! #59918

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:

Summary

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

Upvotes: 3

Related Questions