Install CUDA 10 and cuDNN on Ubuntu 18

Yang Li
2 min readFeb 4, 2020

--

1. Do NOT Install Nvidia driver

### During CUDA 10 installation, the driver will be installed. So just go ahead and install CUDA!!!!

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

#look for latest version number from nvidia website
sudo apt-get install nvidia-driver-440

#after reboot, run below to verify

nvidia-smi

#check installed packages

dpkg -l | grep nvidia

2. Install CUDA 10.1 following below link:

Installation Instructions from nvidia official website:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-ubuntu1804.pin
sudo mv cuda-ubuntu1804.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1804-10-1-local-10.1.243-418.87.00_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-1-local-10.1.243-418.87.00/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

Restart machine.

3. Install cuDNN

Goto page https://developer.nvidia.com/rdp/cudnn-download

Download all three .deb: runtime/developer/code sample

$ sudo dpkg -i libcudnn7_7.6.5.32–1+cuda10.1_amd64.deb (the runtime library),

$ sudo dpkg -i libcudnn7-dev_7.6.5.32–1+cuda10.1_amd64.deb (the developer library), and

$ sudo dpkg -i libcudnn7-doc_7.6.5.32–1+cuda10.1_amd64.deb (the code samples).

Now we can verify the cuDNN installation (below is just the official guide, which surprisingly works out of the box):

  1. Go to the MNIST example code: cd /usr/src/cudnn_samples_v7/mnistCUDNN/.
  2. Compile the MNIST example: sudo make clean && sudo make.
  3. Run the MNIST example: ./mnistCUDNN. If your installation is successful, you should see Test passed! at the end of the output, like this:

REF: https://medium.com/repro-repo/install-cuda-10-1-and-cudnn-7-5-0-for-pytorch-on-ubuntu-18-04-lts-9b6124c44cc

--

--

Responses (2)