CUDA installation download cuda
Enter the nvidia-smi command to view the supported cuda version
If you cannot view it, it means that the nvidia driver has not been installed. Click on the additional driver and select the corresponding version of the driver to download it automatically.
Download the corresponding version of cuda from https://developer.nvidia.com/cuda-toolkit-archive and select the 18.04 version.
gcc downgrade
The gcc version that comes with Ubuntu20.04 is 9.7.0, you need to add gcc7 to install cuda10.2, enter the command to install gcc7
apt-get install gcc-7 g++-7
Check the gcc version, you can see that there are two versions 7 and 9 in the current system
Use update-alternatives for version switching, enter the following command:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7100
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-950
At this time, enter the sudo update-alternatives –config gcc command to view the default version of gcc. You can see that the current default gcc version is 7, which means the switch is successful.
Install cuda
Enter the command to install
sudo sh cuda_10.2.89_440.33.01_linux.run
Click continue
Enter accept
The cuda installation package comes with its own graphics driver, so in this step press the space to remove the option to install the graphics driver, and then select install
Configure environment variables
Enter gedit ~/.bashrc command to open the file, enter the following statement at the end of the file, and save.
export PATH=/usr/local/cuda-10.2/bin${PATH:+:${PATH}}export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Update environment variable configuration
source ~/.bashrc
At this point cuda installation is complete, enter nvcc -V command to view cuda information
Install cuDNN
Download the corresponding version of cudnn from https://developer.nvidia.com/cudnn, you need to log in.
After downloading and decompressing, copy the cuda/include/cudnn.h file to the usr/local/cuda/include folder, copy all the files under cuda/lib64/ to the /usr/local/cuda/lib64 folder, and add read Get permissions:
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
So far cuDNN installation is complete!
Recommended Posts