Installing CUDA 8.0 and cuDNN 5.1 on Ubuntu 16.04

Ike Kramer
1 min readFeb 9, 2017

--

Begin by downloading CUDA (runfile(local) installer)from:

and download cuDNN (you’ll need to register for the Accelerated Computing Developer Program):

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

Installing CUDA

Before CUDA can be installed you, there are a few steps you need to do otherwise you will get an error telling you an X server is running and it won’t let you install.

Control + Alt + F1

Login in with your credentials

$ sudo lightdm stop

This will end your X server

$ sudo init 3

Enter run level 3

Now install CUDA:

cd into the location you have CUDA downloaded

$ sudo sh cuda_8.0.61_375.26_linux.run

Follow the prompts. Once it has completed:

$ sudo service lightdm start

This will restart the X server.

Installing cuDNN

Next you need to uncompress and copy cuDNN to the toolkit directory. The toolkit default install location is /usr/local/cuda

$ tar xvzf cudnn-8.0-linux-x64-v5.1-ga.tgz
$ sudo cp -P cuda/include/cudnn.h /usr/local/cuda/include
$ sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64
$ sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

Now you need to update your bash file

$ gedit ~/.bashrc

With the text editor open, scroll to the bottom and put in these lines:

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64"
export CUDA_HOME=/usr/local/cuda

Save and close it.

Now CUDA and cuDNN are installed and ready to go. If you’d like to use it with tensorflow, do a quick and easy

$ pip install tensorflow-gpu

And you’re good to go

--

--