Wednesday, June 5, 2019

How to install CUDA and 4xx driver on Ubuntu XX.04

Download and install the drivers using the apt-get commands as such:

sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update

You can check which drivers you can install by doing:

ubuntu-drivers list

Install the driver:

sudo apt-get install nvidia-4xx

Reboot your system:

sudo reboot

Check the driver is working with

nvidia-smi

You should see the GPU and memory use

Download the CUDA 1x.0 toolkit and install it following the steps on the script. Skip the step that asks to install the drivers.
https://developer.nvidia.com/cuda-10.0-download-archive

make sure that you also have your cuda and compiler and static libraries on your path and ld library path as explained in the Nvidia documentation. In essence, make sure you have these variables on updated on your ~/.bashrc file

export PATH=$PATH:/usr/local/cuda-10.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64

Try to compile one of the examples from CUDA.
In case you have problems compiling some of the CUDA examples,
install mesa-utils to get glxinfo working to see if your GPU is working with CUDA
and any other updates such as
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev
libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
libglfw3-dev libgles2-mesa-dev

Download cuDNN tar file under cuDNN Linux and install it following the instruction:
https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

Basically:
$ tar -xzvf cudnn-10.0-linux-x64-v7.tgz

Copy the following files into the CUDA Toolkit directory, and change the file permissions.

$ sudo cp cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*





No comments: