Basically this error is due to the fact that libcudnn*.so
files are not present in the installation path of cuda. It appears that on installing the cuda toolkit, the cudnn files are not by default installed. Now the installation path of cuda varies in different machines/installations for example it can be /usr/local/cuda/lib64
, but also in some cases can be /usr/lib/cuda/lib64/
etc.
- Anyway, where ever the installation path maybe, you can find it out by doing
whereis cuda
. - Once that is done, then you need to download the specific cuda version of
cuDNN Library for Linux
from Nvidias website:https://developer.nvidia.com/cudnn
. Here in the following I download and install cuDNN for cuda 10.1.
Version 7 (libcudnn.so.7) can be directly downloaded as
wget https://developer.download.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.1_20191031/cudnn-10.1-linux-x64-v7.6.5.32.tgz?m2hqDRAYQiO6rrilch-TIU9xtf877-R5k-aUI4GXEShM3FY3Sap9Ua4wTj5LUxyQAED2lrSf2NSWhuEn-tQCvEDghZ4f7YUlpKkCq5vTnEXANl9ooqQ6khAZSABike1TaAtw0eKv9njKcy2MZYTSOhmtwdbA9sxe6OlLnm2aP-B8A9XAIFNoFwAmvhwaom2wyNdK2cfJ0je0keQSdHXKat72DEUI4Rpdiw
mv cudnn-10.1-linux-x64-v7.6.5.32.tgz\?m2hqDRAYQiO6rrilch-TIU9xtf877-R5k-aUI4GXEShM3FY3Sap9Ua4wTj5LUxyQAED2lrSf2NSWhuEn-tQCvEDghZ4f7YUlpKkCq5vTnEXANl9ooqQ6khAZSABike1TaAtw0eKv9njKcy2MZYTSOhmtwdbA9sxe6OlLnm2aP-B8A9XAIFNoFwAmvhwaom2wyNdK2cfJ0 cudnn-10.1-linux-x64-v7.6.5.32.tgz
Version 8 (libcudnn.so.8) can be also be directly downloaded as
wget https://developer.download.nvidia.com/compute/machine-learning/cudnn/secure/8.0.5/10.1_20201106/cudnn-10.1-linux-x64-v8.0.5.39.tgz?Usq9mE_Lga0aPT_LueQ-JBpaGOx4qJgy0IzatNF5-ckT2Gat4otxsR88R8kDchN25p4-WUqXP1bLVM54YxAohkczfbGsbs87HIGnsl9fVHILaSbvF8p7ztzFVtaR_jj243gqIkr5IkHDuZvcN8vInVADmTuf9897exXIoqDhGyro-_HbQK9dLoZbsGmWtRLeYPaQsdLCh0UieXk
mv cudnn-10.1-linux-x64-v8.0.5.39.tgz\?Usq9mE_Lga0aPT_LueQ-JBpaGOx4qJgy0IzatNF5-ckT2Gat4otxsR88R8kDchN25p4-WUqXP1bLVM54YxAohkczfbGsbs87HIGnsl9fVHILaSbvF8p7ztzFVtaR_jj243gqIkr5IkHDuZvcN8vInVADmTuf9897exXIoqDhGyro-_HbQK9dLoZbsGmWtRLeYPaQsdLCh cudnn-10.1-linux-x64-v8.0.5.39.tgz
- Extract using
tar -xvzf cudnn-10.1-linux-x64-v7.6.5.32.tgz
assuming we want to installlibcudnn.so.7
- Install the files, by basically copying them in the cuda installation location in step 1. We assume that the cuda toolkit installed in
/usr/local/cuda/*
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
- Set permission to executable
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
Then test the output. Open a python3
prompt and do the following:
import tensorflow as tf
tf.test.is_gpu_available()
If everything is successful, then this should give you a True
at the end.