Tensorflow not detecting GPU

Hello together,

I now lost 3 days of my valuable life trying to get tensorflow to detect and use my GPU to train some neuronal network models and I desperately need help.

I tried uncountable tutorials and forum posts but nothing did work.

I have a MSI GTX 1070 (latest driver)
Windows 10 Pro 64bit
CUDA 11.8.0 (I checked the tf homepage if my versions are compatible, and they should be)
CuDNN 8.6.0
tensorflow 2.12.0
Python 3.10.11

ソースからビルド  |  TensorFlow sais:
tensorflow-2.12.0 python 3.8-3.11 GCC 9.3.1 Bazel 5.3.0 CuDNN 8.6 CUDA 11.8

and I set my system environment variables like I should (adding CUDA and CuDNN paths to “Path”)

I tried seing my GPU with “print(tf.config.list_physical_devices(‘GPU’))” in VSC and Anaconda Prompt and both returned nothing :frowning: Restarting the PC uncountable times didn’t change anything.

I’m really desperate, please help me.

Thanks in advance
Marius

About a year ago I used CUDA in combination with Matlab and it worked just fine, so I know at least that my 1070 is able to work with CUDA.

Hi @Marius, 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. For installing WSL2 please refer to this document. Thank You.

Hi Kiran,
thanks a lot for your response!
Is it possible to uninstall my version of tf and just install tf 2.10? (And the compatible versions of cuda und cudnn to harmonize with tf 2.10)

Hi @Marius , Yes it is possible to uninstall tensorflow by using pip unistalll tensorflow and you can install 2.10 version. Thank You.

Hi @Kiran_Sai_Ramineni

thanks you very much for your help!
I now run following configuration:

Python 3.10.11, TF 2.10.0, CuDNN 8.1.0.77, CUDA 11.2.0

Tensorflow now does find my GPU:

print(tf.config.list_physical_devices(‘GPU’))


[PhysicalDevice(name=‘/physical_device:GPU:0’, device_type=‘GPU’)]

print("Num GPUs Available: ", len(tf.config.list_physical_devices(‘GPU’)))


Num GPUs Available: 1

from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())


[name: “/device:CPU:0”
device_type: “CPU”
memory_limit: 268435456
locality {
}
incarnation: 191322745317478286
xla_global_id: -1
, name: “/device:GPU:0”
device_type: “GPU”
memory_limit: 6957301760
locality {
bus_id: 1
links {
}
}
incarnation: 13611211276137398635
physical_device_desc: “device: 0, name: NVIDIA GeForce GTX 1070, pci bus id: 0000:01:00.0, compute capability: 6.1”
xla_global_id: 416903419
]

Do you have any advice/tips on how to find out wether VSC is now really using my GPU or not? To verify wether it just knows that the GPU is there or it’s actually using it? And is it possible to turn it off or on to use the gpu?

Thanks a lot again!
Cheers
Marius

Hi @Marius, As len(tf.config.list_physical_devices(‘GPU’)) display output as 1, i.e 1 GPU was detected by the tensorflow. Thank You.