Setting up CUDNN and Theano on Ubuntu 14.04 and 15.10

      Comments Off on Setting up CUDNN and Theano on Ubuntu 14.04 and 15.10

CUDNN is a library developed by NVIDIA Inc. which significantly boosts performance on GPU-based (CUDA) Deep Learning algorithms. The best thing about this library is it is free for registered NVIDIA developers and demonstrates up to 2-3X speedups without any changes to your existing code. It has been supported by several leading deep learning frameworks such as Theano and Caffe.

You should get the most significant speedups on GPUs based on the new Maxwell architecture, although Kepler-based GPUs also receive a healthy boost in speed.

It is fairly straightforward to set-up and doesn’t require administrator privileges.


  1. A fully working scientific python environment (Numpy, Scipy, Matplotlib, etc…) such as  Enthought Canopy
  2. Working installation of CUDA 7.0
  3. Installation of an up-to-date Theano from the git repository

Step 1: Register as NVIDIA Developer and download CUDNN v3

Step 2: Extract downloaded cuDNN library into a a user-accessible folder (ex: /home/user/cudnn)

Step 3: Add the following to the ~/.bash_profile file:

export LD_LIBRARY_PATH=/home/path_to/cuda/lib64:$LD_LIBRARY_PATH
export CPATH=/home/path_to/cuda/include:$CPATH
export LIBRARY_PATH=/home/path_to/cuda:$LIBRARY_PATH

Step 4: add the following entry in your ~/.theanorc configuration file:


Step 5: Log-out and re-login into Terminal

Step 6:

$ python -c 'from theano.sandbox.cuda.dnn import version; print(version())'

Should give the following output:

Using gpu device 0: GeForce GTX TITAN (CNMeM is disable)(3002, 3002)