Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save erdemsenguen/d1722e2b2dcd6794de1790af158d8a6c to your computer and use it in GitHub Desktop.
Save erdemsenguen/d1722e2b2dcd6794de1790af158d8a6c to your computer and use it in GitHub Desktop.
Instructions for CUDA v11.8 and cuDNN 8.7 installation on Ubuntu 22.04 for PyTorch 2.0.0

GPU Driver - CUDA - cuDNN

CUDA Toolkit Installation for NVIDIA RTX 50 series GPUs.

Tested on these models:

RTX 5060

RTX 5060 Ti

RTX 5070

RTX 5070 Ti

Most probably is applicable to higher end models.

Install the GPU Drivers

sudo apt purge nvidia* -y

sudo apt remove nvidia-* -y

sudo rm /etc/apt/sources.list.d/cuda*

sudo apt autoremove -y && sudo apt autoclean -y

sudo rm -rf /usr/local/cuda*

sudo apt update && sudo apt upgrade -y

sudo apt install g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev

sudo add-apt-repository ppa:graphics-drivers/ppa

sudo apt update

ubuntu-drivers devices

sudo apt install libnvidia-common-@@@ libnvidia-gl-@@@ nvidia-driver-@@@-open -y

sudo reboot now

Verify Driver Installation

nvidia-smi

Install CUDA Toolkit

wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda_11.8.0_520.61.05_linux.run

sudo sh cuda_11.8.0_520.61.05_linux.run --toolkit --silent --override

This last prompt will not give any output but it is working. Around 3 minute mark it will be done.

Then you can check if it is installed or not by:

nvcc -V

Add CUDA Environment Variables

echo 'export PATH=/usr/local/cuda-11.8/bin:$PATH' >> ~/.bashrc

echo 'export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc

source ~/.bashrc

Download cuDNN

wget https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/linux-x86_64/cudnn-linux-x86_64-8.8.1.3_cuda11-archive.tar.xz

sudo tar -xvf cudnn-linux-x86_64-8.8.1.3_cuda11-archive.tar.xz

sudo mv cudnn-linux-x86_64-8.8.1.3_cuda11-archive cuda

Put cuDNN into CUDA files

sudo cp -P cuda/include/cudnn.h /usr/local/cuda-11.8/include

sudo cp -P cuda/lib/libcudnn* /usr/local/cuda-11.8/lib64/

sudo chmod a+r /usr/local/cuda-11.8/lib64/libcudnn*

Verify the installation

nvidia-smi

nvcc -V

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