Cuda
1 Installation
1.1 Install Nvidia Driver
Get information of your graphic card and available drivers.
unbuntu-drivers devices
Install recommended driver.
sudo apt install nvidia-dirver-xxx
Because ubuntu enables secure boot, the system will require you to set a password for enrolling a MOK(Machine-Owner key) if the MOK is not enrolled during the installation of nvidia driver.
Enter a password for secure boot.
Enter the same password again to confirm the password.
Reboot the system and then enroll MOK.
sudo reboot
During rebooting of the system, you should choose Enroll MOK > Continue > Yes > Enter Password(You have set earlier) > Reboot
.
After the system reboot, validate the version of nvidia driver.
sudo nvidia-smi
1.2 Install Cuda Toolkit
Cuda Toolkit contains nvidia-cuda-dev nvidia-cuda-doc nvidia-cuda-gdb nvidia-cuda-toolkit nvidia-cuda-toolkit-gcc
these packages.
FAQ
1. Use nvprof
to run executable file of Cuda.
sudo nvprof --unified-memory-profiling off <file>