Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorflow 2.2 GPU - which cuDNN library to install?

I have successfully installed CUDA driver, cuDNN libraries and tensorflow. But when running a test program that simply imports tensorflow, I get an error. The error seems to suggest I have the wrong version of cuDNN libraries installed. I'd appreciate some help on this. And if I need to downgrade cuDNN, how do I do it?

Tensorflow version: 2.2 GPU OS: Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-184-generic x86_64) nvcc -V shows the following info:

nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17

nvidia-smi shows the following info:

Fri Jun 12 17:16:38 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.36.06    Driver Version: 450.36.06    CUDA Version: 11.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  GeForce GTX 980 Ti  Off  | 00000000:02:00.0 Off |                  N/A |
| 22%   27C    P8    17W / 250W |     74MiB /  6083MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1489      G   /usr/lib/xorg/Xorg                 71MiB |
+-----------------------------------------------------------------------------+

cuDNN successfully installed following instructions https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#download, but I think I installed version 11.0.

Error message when the program tries to import tensorflow (python 3.6)

2020-06-12 17:21:38.131160: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: 
pciBusID: 0000:02:00.0 name: GeForce GTX 980 Ti computeCapability: 5.2
coreClock: 1.228GHz coreCount: 22 deviceMemorySize: 5.94GiB deviceMemoryBandwidth: 313.37GiB/s
2020-06-12 17:21:38.131384: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudart.so.10.1'; dlerror: libcudart.so.10.1: cannot open shared object file: No such file or directory
2020-06-12 17:21:38.131498: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcublas.so.10'; dlerror: libcublas.so.10: cannot open shared object file: No such file or directory
2020-06-12 17:21:38.133367: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
2020-06-12 17:21:38.133807: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
2020-06-12 17:21:38.137813: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
2020-06-12 17:21:38.137958: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcusparse.so.10'; dlerror: libcusparse.so.10: cannot open shared object file: No such file or directory
2020-06-12 17:21:38.138063: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory
2020-06-12 17:21:38.138085: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1598] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-06-12 17:21:38.138114: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-06-12 17:21:38.138131: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1108]      0 
2020-06-12 17:21:38.138152: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1121] 0:   N 
like image 322
Ziqi Avatar asked Jun 12 '20 16:06

Ziqi


People also ask

Is cuDNN required for TensorFlow?

Based on the information on the Tensorflow website, Tensorflow with GPU support requires a cuDNN version of 8.0. 4. In order to download CuDNN, you have to register to become a member of the NVIDIA Developer Program (which is free).

Is CUDA and cuDNN the same?

What is the difference between cuDNN and CUDA? The cuDNN library is a library optimized for CUDA containing GPU implementations. Think of cuDNN as a library for Deep Learning using CUDA and CUDA as a way to talk to the GPU.

How to install TensorFlow on CUDA?

You can see in the top right corner, CUDA Version: 11.5 Now open your terminal and create a new conda environment. Use the following command and hit “ y “. Here gpu is the name that I given to my conda environment. Activate the conda environment and install TensorFlow (gpu version).

How do I install TensorFlow on my GPU?

To install TensorFlow 2.2 with CUDA capability we will first carry out a series of checks to ensure compatibility with both the hardware and software on the specific worksation. Once these checks are complete we will follow the official TensorFlow GPU installation instructions by installing CUDA, cuDNN, TensorRT and an appropriate Nvidia driver.

What version of TensorFlow does Ubuntu support?

Ubuntu and Windows include GPU support. For TensorFlow 1.x, CPU and GPU packages are separate: Python 3.8 support requires TensorFlow 2.2 or later. macOS 10.12.6 (Sierra) or later (64-bit) (no GPU support) Note: Installing TensorFlow 2 requires a newer version of pip .

How to use TensorFlow with Python?

1. Install the Python development environment on your system 2. Create a virtual environment (recommended) 3. Install the TensorFlow pip package tensorflow —Latest stable release with CPU and GPU support (Ubuntu and Windows) tf-nightly —Preview build (unstable) . Ubuntu and Windows include GPU support .


1 Answers

Going by the following, for tensorflow 2.2 you need CUDA 10.1 and cuDNN 7.4:

https://www.tensorflow.org/install/source_windows#tested_build_configurations

CUDA archive/legacy releases: https://developer.nvidia.com/cuda-toolkit-archive

cuDNN archive, which you have to make an nvidia account to access: https://developer.nvidia.com/rdp/cudnn-archive

Of peculiar note is that there is no cuDNN within the 7.4 releases which is compatible with 10.1, so I would try the 7.5.0. Installing cuDNN is simply a matter of copying the files that you download into the folder where you installed CUDA (in their respective folders).

like image 185
Audio Guy Avatar answered Sep 27 '22 20:09

Audio Guy