CUDA

Install nvidia CUDA runtime and compatible GPU driver from NVIDIA: https://developer.nvidia.com/cuda-toolkit

For Ubuntu 24.04:

# Clean previous installations
sudo apt autoremove 'cuda*' 'nvidia*' --purge
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update && sudo apt install cuda-toolkit-12-8 cuda-drivers

Add the CUDA compiler (nvcc) to the system PATH:

~/.profile
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}

For WSL2, install Windows NVIDIA GPU driver first; then install the CUDA toolkit in the WSL.

sudo apt-key del 7fa2af80 # remove the old GPG key
# Install Linux CUDA toolkit
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-keyring_1.1-1_all.deb
sudo dpkg -i cuda-keyring_1.1-1_all.deb
sudo apt update && sudo apt install -y cuda

Comments