Install CUDA 10.1 without APT repository on Linux Mint 19.3

by Ugnius Malūkas

These days many people use NVIDIA graphic cards for increasing speed of computing time, for example, calculating outcomes of Machine Learning algorithms. In order to use a graphic processing of Nvidia GPUs, CUDA has to be installed. This article shows how to install CUDA, cuDNN and TensorRT packages without having a Nvidia APT repository.

Installation

Be sure that you have already installed Nvidia GPU drivers. My recommendation is to install it trough Driver Manager.

1) Download CUDA 10.1:

$ wget https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.105_418.39_linux.run

2) Run cuda_10.1.105_418.39_linux.run:

$ sudo sh cuda_10.1.105_418.39_linux.run

Screen picture:

CUDA installation

3) After installation you need open /etc/environment:

$ sudo nano /etc/environment

Append PATH in /etc/environment file with a following line:

:/usr/local/cuda-10.1/bin:/usr/local/cuda-10.1/NsightCompute-2019.1

4) Depending on your machine (64-bit or 32-bit) append LD_LIBRARY_PATH (or add if does not exist) in /etc/environment:

64-bit:

:/usr/local/cuda-10.1/lib64

32-bit:

:/usr/local/cuda-10.1/lib

5) After 3rd and 4th step your /etc/environment file should look like this:

/etc/environment file

6) Restart the computer:

$ sudo reboot

Validate CUDA Installation

Go to ~/NVIDIA_CUDA-10.1_Samples/:

$ cd ~/NVIDIA_CUDA-10.1_Samples/

Run:

$ sudo make

Then go to ~/NVIDIA_CUDA-10.1_Samples/0_Simple/asyncAPI and run asyncAPI:

cd ~/NVIDIA_CUDA-10.1_Samples/0_Simple/asyncAPI
./asyncAPI

If there are no errors and just warnings, installation is complete.

Install cuDNN

Go to https://developer.nvidia.com/rdp/cudnn-download.

Press Download cuDNN v7.6.Y, for CUDA 10.1.

Then press to download these selections: * cuDNN Runtime Library for Ubuntu18.04 (Deb), * cuDNN Developer Library for Ubuntu18.04 (Deb), * cuDNN Code Samples and User Guide for Ubuntu18.04 (Deb).

Install downloaded files:

sudo dpkg -i libcudnn7_7.6.Y.Z-1+cuda10.1_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.Y.Z-1+cuda10.1_amd64.deb
sudo dpkg -i libcudnn7-doc_7.6.Y.Z-1+cuda10.1_amd64.deb

Verify Installation:

Copy cuDNN samples:

$cp -r /usr/src/cudnn_samples_v7/ ~

Go to mnistCUDNN folder:

$ cd ~/cudnn_samples_v7/mnistCUDNN

Compile and run:

$ make clean && make
./mnistCUDNN

If you see Test passed! at the end of the output then installation is complete.

(Optional) Install Nvidia Libraries Required by TensorFlow

If you are planning to install TensorFlow (2.1.0+), TensorRT is needed to use that library.

1) Download and install libnvinfer6:

$ wget https://developer.download.nvidia.cn/compute/machine-learning/repos/ubuntu1804/x86_64/libnvinfer6_6.0.1-1+cuda10.1_amd64.deb
sudo dpkg -i --ignore-depends=libcublas10,cuda-cudart-10-1 libnvinfer6_6.0.1-1+cuda10.1_amd64.deb

2) Download and install libnvinfer-dev:

$ wget https://developer.download.nvidia.cn/compute/machine-learning/repos/ubuntu1804/x86_64/libnvinfer-dev_6.0.1-1+cuda10.1_amd64.deb
$ sudo dpkg -i --ignore-depends=libcublas-dev,cuda-cudart-dev-10-1 libnvinfer-dev_6.0.1-1+cuda10.1_amd64.deb

3) Download and install libnvinfer-plugin:

$ wget https://developer.download.nvidia.cn/compute/machine-learning/repos/ubuntu1804/x86_64/libnvinfer-plugin6_6.0.1-1+cuda10.1_amd64.deb
$ sudo dpkg -i libnvinfer-plugin6_6.0.1-1+cuda10.1_amd64.deb

Conclusion

If there is a possibility of having an APT repository, I recommend installing CUDA, cuDNN and TensorRT libraries via APT because many of the above mentioned steps would not be needed and would require less effort.