I recorded the work when CUDA and cuDNN corresponding to the version of tensorflow were installed locally for machine learning with tensorflow.
This article has set up CUDA 10.1 and cuDNN 7.6 to use tensorflow 2.3.0.
Ubuntu 20.04
https://codelabo.com/posts/20200229081221
https://medium.com/@exesse/cuda-10-1-installation-on-ubuntu-18-04-lts-d04f89287130
--1: NDIVIA driver installation -2: CUDA Setup --3: cuDNN Setup
Download site: https://developer.nvidia.com/cudnn Nvidia account registration is required in advance. You can select the version from the archive of the download site.
Refer to Official guide and execute it sequentially.
$ tar -zxvf cudnn-10.1-linux-x64-v7.6.5.32.tgz
Copy cudnn to either cuda /
or cuda- <version> /
. The official documentation says cuda /
, but it seems that cuda- <version> /
and cuda /
are linked, and copying to cuda- <version> /
worked fine.
# cuda-<version>/When copying to
$ sudo cp cuda/include/cudnn*.h /usr/local/cuda-<version>/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda-<version>/lib64
$ sudo chmod a+r /usr/local/cuda-<version>/include/cudnn*.h /usr/local/cuda-<version>/lib64/libcudnn*
# cuda/When copying to
$ sudo cp cuda/include/cudnn*.h /usr/local/cuda/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*
Please put the version of CUDA you put in <version>
.
Install CUDA in advance. Please refer to CUDA Setup.
If you add it, it will automatically select the PATH of the optimum CUDA version and execute it.
Reference: https://qiita.com/takeajioka/items/8737fab5cffbe0118fea
In fact, there are many ways to do it. Change the path described in ~ / .bashrc.
Example
<Before change 10.1>
export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
<After change 11.0>
export PATH=/usr/local/cuda-11.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
cuda- <version> /
If you switch the version of cuda loaded on your pc, it will automatically switch to the version of cudnn that is copied to the changed cuda. (I haven't done it yet)
cuda /
/usr/local/cuda/include
/usr/local/cuda/lib64
Since the old cudnn is included in, delete it and copy the newly downloaded version of cudnn in the same way.
$ sudo rm /usr/local/cuda/include/cudnn*.h
$ sudo rm /usr/local/cuda/lib64/libcudnn*
If you copy it to cuda /
, you will be required to delete it when you change cuda, so it may be more convenient to copy it to cuda- <version>
and change it for each cuda.
Recommended Posts