Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inksong/8c11677d257bfc768392fecc4596c547 to your computer and use it in GitHub Desktop.
Save inksong/8c11677d257bfc768392fecc4596c547 to your computer and use it in GitHub Desktop.
Install cuda10.1 and cudnn 7.6.5 on Ubuntu 18.04
# Install Cuda 10.1 and Cudnn 7.6.5 on Ubuntu 18.04
## Start clean
sudo apt purge nvidia*
sudo apt remove nvidia-*
sudo rm /etc/apt/sources.list.d/cuda*
sudo apt autoremove && apt autoclean
sudo rm -rf /usr/local/cuda*
## Install some dependencies
sudo apt install -y g++ freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
## Add CUDA repository
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" | sudo tee /etc/apt/sources.list.d/cuda.list
## Run update
sudo apt update
## Install Nvidia Driver 440
sudo apt install -y nvidia-driver-440
## Install CUDA-10.1
sudo apt-get -o Dpkg::Options::="--force-overwrite" install cuda-10-1 cuda-drivers
## Set CUDA paths
echo 'export PATH=/usr/local/cuda-10.1/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
ldconfig
## Download Cudnn 7.6.5 for CUDa 10.1
- Go to https://developer.nvidia.com/cudnn
- Create an account
- Download the suitable version of Cudnn from https://developer.nvidia.com/rdp/cudnn-download
- Extract the downloaded file `tar -xzvf <filename>`
- Copy the following files into the CUDA directory
sudo cp -P cuda/include/cudnn.h /usr/local/cuda-10.1/include
sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda-10.1/lib64/
sudo chmod a+r /usr/local/cuda-10.1/lib64/libcudnn*
## Restart the PC
Restart your PC to apply the changes
## Check that everything went the right way
nvidia-smi
nvcc -V
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment