I am trying to enable my nvidia gtx 1050 mobile
gpu for tensorflow v2.9
. Here is what I have so far:
The proper driver for my graphics card is 470.xx as per this question. I have installed 470.129.06 . When I do nvidia-smi
in terminal I get:
My cuda tookit is 11.4:
My cuDNN is v8.2.4:
All of these dependencies should be compatible with each other as per these docs.
However, when I try to see whether GPU is available in tensorflow
I get this:
With the error: Could not load dynamic library 'libcudnn.so.8'
.
Contrary to the above support matrix of cuDNN in these docs it says that for tensorflow v2.9
I need cuDNN v8.1
and cuda v11.2
.
Does anyone know what is causing the error above? Or what is the proper combination of these libraries is?
2
Answers
The way to solve your compatibility issues, is to install the recommended
cuda-toolkit
andcuDNN
libraries from the tensorflow compatibility site. You don't necessarily install the graphics driver that's compatible with yourcuda-toolkit
, but the one that's compatible with your gpu. For me it was any driver 470.xx for anvidia gtx 1050 mobile
. More precisely, 470.129.06, along withcuda toolkit v11.2
andcuDNN v8.1
.This error seems to arise due to improper installation of Tensorflow. A quick and recommended way to get around this would be to install Tensorflow using Conda, as follows:
However, the above commands would not support Tensorflow 2.9 as Conda supports upto 2.6 directly as of writing this answer (20/06/22).
If you would like to have a clean installation of Tensorflow 2.9, I would suggest the following commands:
These commands would ensure a clean installation in a Containerized environment, and if there is something wrong, Conda might look for ways to resolve dependency conflicts.
Another hassle free option to set the right dependencies for Tensorflow v2.9 would be to simply use a Docker container provided by the developers, such as one here. The container should automatically install the right dependencies, and you should be able to spawn Jupyter Notebook / Jupyter Lab from the Docker container without running into any TF dependency issues as the Docker container would be pre-configured.