CUDA toolkit is an extension of the Graphics Processing Unit parallel computing architecture developed by NVIDIA. It also enhances the performance of the computer by using the power of the GPU. Programmers can use it through popular programming languages.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related NVIDIA queries.
In this context, we shall look into how to install CUDA on Ubuntu 20.04.
1. Update system packages
To do this, run the below command:
$ sudo apt update
2. Install CUDA toolkit
Now we start installing the CUDA toolkit by apt command:
$ sudo apt install nvidia-cuda-toolkit
Now that we have successfully installed CUDA on your Linux system, we must add CUDA to PATH, so that the shell knows where CUDA is located. Let's open the .profile file by vim command:
$ sudo vim ~/.profile
Then add the following lines to the end of the file and save:
# set PATH for cuda 10.1 installation
if [ -d "/usr/local/cuda-10.1/bin/" ]; then
export PATH=/usr/local/cuda-10.1/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
fi
After saving this file, reboot the system with the below command:
$ sudo reboot
To do this, simply execute the below command:
$ nvcc --version
This article covers how to install CUDA on Ubuntu 20.04.
To install CUDA on Ubuntu, execute the following commands:
$ sudo apt update
$ sudo apt install nvidia-cuda-toolkit
To Check your CUDA version, run the below command:
$ nvcc --version