How To Install CUDA Toolkit Latest on Ubuntu


Table 1. CUDA Toolkit and Compatible Driver Versions
CUDA Toolkit
Linux x86_64 Driver Version
Windows x86_64 Driver Version
CUDA 10.1.105
>= 418.39
>= 418.96
CUDA 10.0.130
>= 410.48
>= 411.31
CUDA 9.2 (9.2.148 Update 1)
>= 396.37
>= 398.26
CUDA 9.2 (9.2.88)
>= 396.26
>= 397.44
CUDA 9.1 (9.1.85)
>= 390.46
>= 391.29
CUDA 9.0 (9.0.76)
>= 384.81
>= 385.54
CUDA 8.0 (8.0.61 GA2)
>= 375.26
>= 376.51
CUDA 8.0 (8.0.44)
>= 367.48
>= 369.30
CUDA 7.5 (7.5.16)
>= 352.31
>= 353.66
CUDA 7.0 (7.0.28)
>= 346.46
>= 347.62


Step 1: Download the NVIDIA CUDA Toolkit

I have Ubuntu 18.04.2 x64 (64 bit), NVIDIA Driver 415, so I downloaded CUDA 10.0.130. You can download latest CUDA from HERE or older versions HERE.



Step 2: Install repository meta-data
sudo dpkg -i <NAME_DOWNLOADED_TOOLKIT>
For example:

sudo dpkg -i cuda-repo-ubuntu1804-10-0-local-10.0.130-410.48_1.0-1_amd64.deb


Step 3: Installing the CUDA public GPG key

To install the key, run this command:

sudo apt-key add /var/cuda-repo-<version>/7fa2af80.pub
For example:

sudo apt-key add /var/cuda-repo-10-0-local-10.0.130-410.48/7fa2af80.pub


Step 3: 



sudo apt-get update


Step 4:

sudo apt-get install cuda



Post-installation Actions

Some actions must be taken after the installation before the CUDA Toolkit and Driver can be used.

Update the PATH variable to include the CUDA binaries folder. To update it, we need to edit the file /etc/environment. I use the nano text editor in this post, so the command would be:

sudo nano /etc/environment


After editing this line press Ctrl + X to exit the editor and press Y when prompted whether you want to save it.

This method of editing the PATH variable usually requires a reboot to take effect. However executing the below command would update the PATH variable immediately.

source /etc/environment


Alternatively you can also execute the command nvidia-smi in the terminal. This gives more detailed information about the drivers.

If you received error: Failed to initialize NVML: Driver/library version mismatch, surprise, rebooting solved the issue.

I don't know why, but after rebooting, my NVIDIA Driver downgraded to version 410.


Open application Software & Updates > Addtional Drivers, recheck Using NVIDIA driver metapackage from nvidia-drive-415 (open source) (or other latest you have), click Apply Changes, reboot the computer and enjoy latest NVIDIA driver^^





Good luck!

Post a Comment

0 Comments