Code Monkey home page Code Monkey logo

install_cuda_cudnn_ubuntu_20's Introduction

NVIDIA Driver, CUDA 11.4, cuDNN v8.2.4 installation on Ubuntu 20.04

Uninstall previous versions

  • First of all remove all related versions of NVIDIA driver, CUDA and cuDNN by executing the following commands.
sudo apt-get --purge remove "*cublas*" "cuda*" "nsight*" 
sudo apt-get --purge remove "*nvidia*"
sudo rm -rf /usr/local/cuda*
sudo apt autoremove

Installation of NVIDIA Drivers, CUDA and cuDNN

NVIDIA Drivers

Install CUDA matching NVIDIA Driver version

  • In this tutorial, I am going to install CUDA 11.4.3 (Although 11.5 is the latest one at the time of writing this tutorial).
wget https://developer.download.nvidia.com/compute/cuda/11.4.3/local_installers/cuda_11.4.3_470.82.01_linux.run
  • After running the below command, make sure that you uncheck NVIDIA Driver option (as shown below) as we have already installed it in the previous step.
sudo sh cuda_11.4.3_470.82.01_linux.run

  • After successful installation, you will get a warning message (as shown below) that it did not install CUDA Driver, just ignore it as we had installed it separately before.

Add CUDA path to the bashrc file

  • For programs to be able to recognize the location of CUDA, we must add PATH to the bashrc file. Execute the following commands to add CUDA path.
echo 'export PATH=/usr/local/cuda-11.4/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.4/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
sudo ldconfig

Installation of cuDNN matching CUDA version

  • Installation of cuDNN is highly recommended to speed up calculations further. You must have an NVIDIA account to download cuDNN. Please create your account before downloading.

  • Download cuDNN from here: https://developer.nvidia.com/rdp/cudnn-archive

- In this tutorial, I am going to install `cuDNN v8.2.4` for `CUDA 11.4`.
  • There are several ways to install cuDNN but the simplest is to download the compressed file and extract to relevant CUDA directory.
tar -xzvf ${CUDNN_TAR_FILE}
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-11.4/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-11.4/lib64/
sudo chmod a+r /usr/local/cuda-11.4/lib64/libcudnn*

Verify Installation

  • If you followed the above steps correctly, NVIDIA drivers, CUDA and cuDNN should have installed correctly.

  • Execute nvidia-smi and nvcc --version to see if everything is working as expected and the CUDA versions match for them.

nvidia-smi

nvcc --version

Issues

Feel free to open issues if you face any problem. Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.