1. Installation of the driver for GPU (if it is not installed yet).

Download the driver from NVIDIA official website: https://www.nvidia.ru/Download/index.aspx?lang=ru

In my case the downloaded file is named: NVIDIA-Linux-x86_64-440.44.run

In order to install it, we switch to the console more with Ctrl + Alt + F1 and run the commands from the list:

  1. Turning off lightdm service: sudo service lightdm stop
  2. Run the downloaded file: sudo bash NVIDIA-Linux-x86_64-440.44.run
  3. Restart the computer: sudo reboot

If everything is installed correctly, the command nvidia-smi should show the information about your GPU and the driver's version:


2. CUDA installation.

Download from NVIDIA official website: https://developer.nvidia.com/cuda-downloads

Choose deb (local) and run the commands listed there. In my case they are following:

wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-ubuntu1604.pin
sudo mv cuda-ubuntu1604.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget http://developer.download.nvidia.com/compute/cuda/10.2/Prod/local_installers/cuda-repo-ubuntu1604-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1604-10-2-local-10.2.89-440.33.01_1.0-1_amd64.deb
sudo apt-key add /var/cuda-repo-10-2-local-10.2.89-440.33.01/7fa2af80.pub
sudo apt-get update
sudo apt-get -y install cuda

After that restart the computer and try nvidia-smi again.

3. Appending PATH

Insert export PATH=/usr/local/cuda/bin:$PATH into ~/.bashrc. After that open terminal and run nvcc --version that will output the version of CUDA compiler:

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