Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save minhhieutruong0705/e4a82d6b7f1b182dafa8c55090dd19ca to your computer and use it in GitHub Desktop.
Save minhhieutruong0705/e4a82d6b7f1b182dafa8c55090dd19ca to your computer and use it in GitHub Desktop.

Install Nvidia Driver CUDA and cuDNN on Ubuntu

Jan 2nd, 2022

Index

System Specification Check

  • Check your system architecture to select correct installers for your platform
    $ uname -m
    $ dpkg --print-architecture

NVIDIA Driver Installation

  1. Remove old installation
    $ sudo apt-get purge nvidia-*
    $ sudo apt-get update 
    $ sudo apt-get autoremove # DO NOT skip this line
  2. Search for latest version of Nvidia driver
    $ apt search nvidia-driver
  3. Install Nvidia libraries
    $ sudo apt install libnvidia-common-<version>
    $ sudo apt install libnividia-gl-<version>
  4. Install Nvidia driver
    $ sudo apt install nvidia-driver-<version>
  5. Reboot and check for the installation
    $ nvidia-smi

CUDA Toolkit Installation

  1. Intsall kernel headers and developement packages for your currently running kernel
    $ sudo apt-get install linux-headers-$(uname -r)
  2. Download and install CUDA Toolkit
  • CUDA Toolkit from Nvidia Developer
    • Select target platform
    • Recommendation: pick deb [network] option of Installer Type
    • Follow the installation instruction on the download page to install CUDA Toolkit
  • To include GDS package with CUDA Toolkit
    $ sudo apt-get install nvidia-gds 
  1. Setup environment
  • Config $PATH variable with following script:
    CUDA_HOME=/usr/local/cuda
    PATH=${CUDA_HOME}/bin${PATH:+:${PATH}}
    LD_LIBRARY_PATH=${CUDA_HOME}/lib64 ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
    export LD_LIBRARY_PATH
    export CUDA_HOME
    export PATH
  • Add the script to either:
    • ~/.bashrc for user session usage
    • /etc/profile for system wide usage
  1. Setup POWER9
  • Check NVIDIA Persistence Daemon
    $ systemctl status nvidia-persistenced
  • If it is not loaded
    $ sudo systemctl enable nvidia-persistenced
  1. Reboot and check for installation
    $ nvcc --version

cuDNN Installation

  1. Download cuDNN:
  • Nvidia cuDNN from Nvidia Developer (local installer)
    • NVIDIA Developer Program Membership is required to download
    • Select CUDA matching version and target platform
  1. Install cuDNN
  • Import CUDA GPG key
    $ sudo dpkg -i <downloaded-file>
    $ sudo apt-key add /var/cudnn-local-repo-*/7fa2af80.pub
    $ sudo apt-get update
  • To auto-match version of cuDNN v8 with version of CUDA when installing:
    $ sudo apt-get install libcudnn8
    $ sudo apt-get install libcudnn8-dev 
    $ sudo apt-get install libcudnn8-samples 

Nvidia Documentation

My Installation

  • Operating System: Ubuntu 20.04 x84_64 (64-bit)
  • Architecture: amd64
  • GPU: Nvidia GeForce GTX 1050
  • Installation with success on: Jan 2nd, 2022
@minhhieutruong0705
Copy link
Author

Hi @UTKRISHTPATESARIA ,

You are correct! We can have GSD on RTX 3090 in compatibility mode, but GSD cannot do anything with DMA on RTX 3090. I did not aware of this because I did not use much my RTX 3090. What we will have with sudo apt-get install nvidia-gds are only the GDS packages. Sorry for my previous incorrect information.

https://forums.developer.nvidia.com/t/gpudirect-available-on-ubuntu-18-04/192420/5

@UTKRISHTPATESARIA
Copy link

Thanks for sharing.

Let me see if I can setup GPU Direct RDMA using some custom build or stuff. That's the last hope for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment