CUDA 11.2 installation on Ubuntu 20.04
github gist: link
NVIDIA Driver installation with cuda 11.2 and cudnn 8.2.0.53
You will need to install followings:
- NVIDIA graphics card driver (v460.80)
- CUDA (v11.2.0)
- cuDNN (v8.2.0.53)
Installing the NVIDIA graphics card driver
- Download the NVIDIA driver: https://www.nvidia.com/en-us/drivers/unix/. I installed the latest version of NVIDIA
driver which is v460.80 (2021, May).
After finished downloading, install by using following command:
sudo sh NVIDIA-Linux-x86_64–460.80.run
Errors:
- An NVIDIA kernel module ‘nvidia-drm’ appears to already be loaded in your kernel
You get this error when you’re upgrading NVIDIA driver. Because of the previous version of NVIDIA driver could not be
deleted completely while upgrading. To solve this firstly you should stop all processes which are using your GPU on that
time.
Solution:
1. Open X-Window by Ctrl+Alt+F3
. Enter login and password.
2. Remove NVIDIA driver:
sudo apt-get purge nvidia*
sudo apt-get autoremove
reboot
3. Open X-Window again Ctrl+Alt+F3
. Enter login and password.
4. sudo -i
for super user.
5. Close all processes:
system isolate multi-user.target
modprobe -r nvidia-drm
6. Then install the driver sudo sh NVIDIA-Linux-x86_64–460.80.run
Installing CUDA v11.2.0
1. Download the CUDA by following command:
wget https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda_11.2.0_460.27.04_linux.run
2. Install CUDA v11.2.0:
sudo sh cuda_11.2.0_460.27.04_linux.run
After you finished installing CUDA, you will get this message:
===========
= Summary =
===========Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-11.2/
Samples: Installed in /home/user-name/, but missing recommended librariesPlease make sure that
— PATH includes /usr/local/cuda-11.2/bin
— LD_LIBRARY_PATH includes /usr/local/cuda-11.2/lib64, or, add /usr/local/cuda-11.2/lib64 to /etc/ld.so.conf and run ldconfig as rootTo uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-11.2/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-11.2/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least .00 is required for CUDA 11.2 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run — silent — driver
3. Configure it according to message above:
export PATH=/usr/local/cuda-11.2/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64:$LD_LIBRARY_PATH
Installing cuDNN v8.2.0.53
1. Download cuDNN v8.2.0.53 from here
After downloading, un-tar the file and copy the following files to necessary locations:
tar -xzvf cudnn-11.3-linux-x64-v8.2.0.53.tgzsudo cp cuda/include/cudnn*.h /usr/local/cuda-11.2/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-11.2/lib64
sudo chmod a+r /usr/local/cuda-11.2/include/cudnn*.h /usr/local/cuda-11.2/lib64/libcudnn*
**Done!**
It was my first time to use Linux for deep learning. Finally I installed and it’s currently working on my workstation.