Install CUDA 11.1 & cuDNN

本文最后更新于:2020年10月26日 下午

This Blog is writing for steps of CUDA installing on Ubuntu 20.04.

Install CUDA 11.1

  1. Check Updates
sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
  1. Switch Navida Metapackage Version

    Open Software & Updates and switch Navida metapackage to 455.
    Apply Changes.

    reboot
  1. Download Installer for Linux Ubuntu 20.04 x86_64 (https://developer.nvidia.com/cuda-downloads)
wget https://developer.download.nvidia.com/compute/cuda/11.1.0/local_installers/cuda_11.1.0_455.23.05_linux.run
sudo sh cuda_11.1.0_455.23.05_linux.run

On the first prompt choose Continue.
On the second prompt press Enter add the first metapackage to blacklist.
Choose Install.

  1. Config Environment Variables
gedit ~/.bashrc
# Add these lines to bashrc file.
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64
export PATH=$PATH:/usr/local/cuda/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda
# Exit current terminal and open a new terminal.
# Config bashrc.
source ~/.bashrc
# Do the same with zshrc.
  1. Test CUDA
    cd /usr/local/cuda/samples/1_Utilities/deviceQuery
    make # If permission denied type $ sudo make
    ./deviceQuery #If permission denied type $ sudo ./deviceQuery
    
    # Result = PASS indicate CUDA has installed successfully.

Install cuDNN

  1. Download cuDnn
  1. Extract Files

    cd ~/Downloads
    tar -xzf cudnn-11.1-linux-x64-v8.0.4.30.tgz
  2. Copy Files to Dictionary

    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*

本博客所有文章除特别声明外,均采用 CC BY-SA 4.0 协议 ,转载请注明出处!