Source: https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html
All version doc: https://developer.nvidia.com/cuda-toolkit-archive
Download: http://developer.nvidia.com/cuda-downloads
NOTE 1: this guide is best for installing from fresh (no previous installation) & support install multiple version of cuda toolkit
NOTE 2: we can install multiple version of cuda toolkit on the same system but can only run one of them at a time. A tip for switching between different versions is mentioned below
Step 1: Install nvidia driver
NOTE: For choosing nvidia driver according to target cuda toolkit version, refer to cuda toolkit release notes - Table 3. CUDA Toolkit and Corresponding Driver Versions
Step 2: Check for maximum supported cuda toolkit version according to installed driver
nvidia-smi
Ex:
any cuda toolkit version <= 11.2 is compatiple with current system
Step 1: Download cuda toolkit runfile (version according to above pre-installation steps) from nvidia websites
Step 2: Go to download folder & run the installation file
NOTE: Remember to exclude driver installation included in the runfile
sudo sh <runfile>.run
Follow instruction on download page
Follow instruction on download page
Create symlink from /usr/local/cuda
to /usr/local/cuda-<version>
(remove existing cuda symlink if necessary)
sudo ln -s /usr/local/cuda-<version> /usr/local/cuda
NOTE: This is also used for switching between version of cuda toolkit
Check the name of nsight-compute
in cuda toolkit installed directory
Modify & add these lines accordingly to ~/.bashrc
or ~/.profile
(for local users) or /etc/profile
(for system-wide users) & restart terminal/OS
if [ -d "/usr/local/cuda/bin/" ]; then
export PATH=/usr/local/cuda/bin:/usr/local/cuda/nsight-compute-<version>${PATH:+:${PATH}}
fi
Add /usr/local/cuda/lib64
to /etc/ld.so.conf.d/<cuda_config>.conf
file and run ldconfig
as root
sudo bash -c "echo /usr/local/cuda/lib64 > /etc/ld.so.conf.d/cuda.conf"
sudo ldconfig
NOTE: Later version of cuda toolkit installer has done this so no need to (
/etc/ld.so.conf.d/cuda-<version>.conf
)
Same as runfile on Ubuntu
Follow instruction on download page
NOTE: Remove
nvidia-driver-latest-dkms
since driver has been installed
Follow instruction on download page
NOTE: Remove
nvidia-driver-latest-dkms
since driver has been installed
Same as ubuntu version
Add file <cuda_PATH_conf>.sh
to /etc/profile.d/ with below content
if [ -d "/usr/local/cuda/bin/" ]; then
pathmunge /usr/local/cuda/bin
pathmunge /usr/local/cuda/nsight-compute-<version>
fi
Same as ubuntu version
Run below command to check for installed & running version:
nvcc --version
ll /usr/local/
A symlink created to re-direct any access to cuda to current in-use version
To uninstall, take reference from installation guide in accordance with your installation method.
For unintall tar file method, if uninstaller file not exist, go to release section of this repo & download it from there.