Driver and CUDA Version Compatibility
Before beginning the installation, verify that your GPU driver version supports the target CUDA Toolkit version. The following table maps CUDA releases to their minimum required driver versions:
| CUDA Version | Linux Driver (x86_64) | Windows Driver (x86_64) |
|---|---|---|
| 11.2.1 | >= 460.32.03 | >= 461.09 |
| 11.2.0 | >= 460.27.03 | >= 460.82 |
| 11.1.1 | >= 455.32 | >= 456.81 |
| 11.1.0 | >= 455.23 | >= 456.38 |
| 11.0.3 | >= 450.51.06 | >= 451.82 |
| 10.2.89 | >= 440.33 | >= 441.22 |
| 10.1 | >= 418.39 | >= 418.96 |
| 10.0.130 | >= 410.48 | >= 411.31 |
| 9.2 | >= 396.37 | >= 398.26 |
| 9.1 | >= 390.46 | >= 391.29 |
| 9.0 | >= 384.81 | >= 385.54 |
| 8.0 | >= 375.26 | >= 376.51 |
GPU Driver Installation
Detecting Available Drivers
Query the system for detected NVIDIA hardware and available driver packages:
ubuntu-drivers devices
Typical output displays detected GPU devices along with available driver versions:
== /sys/devices/pci0000:00/0000:01:00.0/0000:02:00.0 ==
modalias : pci:v000010DEd00001F36sv0000103Csd0000860Fbc03sc00i00
vendor : NVIDIA Corporation
driver : nvidia-driver-460 - distro non-free recommended
driver : nvidia-driver-450 - distro non-free
driver : nvidia-driver-440-server - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin
If the command is unavailable, install it first:
sudo apt-get update && sudo apt-get install -y ubuntu-drivers-common
Installation Methods
Method 1: Manual Installation via Runfile
Download the appropriate driver .run file and execute with flags to prevent display manager conflicts:
sudo ./NVIDIA-Linux-x86_64-460.39.run \
--no-x-check \
--no-nouveau-check \
--no-opengl-files
The flags serve the following purposes:
--no-x-check: Prevents starting/stopping the X display server during installation--no-nouveau-check: Disables the nouveau kernel driver temporarily--no-opengl-files: Skips OpenGL library instlalation, avoiding login loop issues
Method 2: Package Manager Installation
sudo apt-get update
sudo apt-get install -y nvidia-driver-460
sudo reboot
Verification
Confirm successful installation:
cat /proc/driver/nvidia/version
Expected output:
NVRM version: NVIDIA UNIX x86_64 Kernel Module 450.102.04
GCC version: gcc version 7.5.0
Uninstallation
To remove all NVIDIA driver packages:
sudo apt-get purge nvidia*
sudo apt-get autoremove
Useful Commands
Add the graphics drivers PPA for additional driver options:
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
sudo apt-get install nvidia-driver-460 nvidia-settings nvidia-prime
Monitor GPU status:
nvidia-smi
CUDA Toolkit Installation
Prerequisites
Verify NVIDIA device files are present:
ls -la /dev/nvidia*
Expected output:
crw-rw---- 1 root root 226, 0 /dev/nvidia0
crw-rw---- 1 root root 226, 128 /dev/nvidiactl
crw-rw---- 1 root root 226, 129 /dev/nvidia-modeset
crw-rw---- 1 root root 226, 130 /dev/nvidia-uvm
crw-rw---- 1 root root 226, 131 /dev/nvidia-uvm-tools
Installation via Local Debian Package
Download the appropriate CUDA repository package from NVIDIA's developer portal, then install:
sudo dpkg -i cuda-repo-ubuntu1804-11-2-local_11.2.1-460.32.03-1_amd64.deb
sudo apt-key add /var/cuda-repo-ubuntu1804-11-2-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install -y cuda
Environment Configuration
Append the following to ~/.bashrc:
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}
export PATH=${CUDA_HOME}/bin:${PATH}
Apply changes to the current session:
source ~/.bashrc
Verification
Check the CUDA compiler version:
nvcc --version
Successful output:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Wed_Oct_23_19:24:38_PDT_2019
Cuda compilation tools, release 10.2, V10.2.89
cuDNN Installation
Download the cuDNN library package compatible with your CUDA version. For CUDA 11.2, the package typically follows the naming pattern libcudnn8_*_cuda11.2_amd64.deb.
Install the package:
sudo dpkg -i libcudnn8_8.1.0.77-1+cuda11.2_amd64.deb
Update the library cache:
sudo ldconfig
Troubleshooting
Issue: After installing CUDA and cuDNN, the GPU driver fails to load after reboot.
Solution: Reinstall the GPU driver:
sudo apt-get install --reinstall nvidia-driver-460
sudo reboot
After the reboot, nvidia-smi should display the driver version correctly.