skip to Main Content

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:

enter image description here

My cuda tookit is 11.4:

enter image description here

My cuDNN is v8.2.4:

enter image description here

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:

enter image description here

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


  1. Chosen as BEST ANSWER

    The way to solve your compatibility issues, is to install the recommended cuda-toolkit and cuDNN libraries from the tensorflow compatibility site. You don't necessarily install the graphics driver that's compatible with your cuda-toolkit, but the one that's compatible with your gpu. For me it was any driver 470.xx for a nvidia gtx 1050 mobile. More precisely, 470.129.06, along with cuda toolkit v11.2 and cuDNN v8.1.


  2. 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:

    conda create --name tf_gpu tensorflow-gpu 
    conda activate tf_gpu
    

    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:

    conda install -c conda-forge cudatoolkit=11.2 cudnn=8.1.0
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CONDA_PREFIX/lib
    python3 -m pip install tensorflow==2.9.0
    

    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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search