Installing Theano and integrating it with GPU on Ubuntu.

If you have a working experience on theano, you probably wouldn’t have forgot that such a pain in the ass task it was. So I felt it really worth to blog about it for people aspiring to get in Deep Learning. Installation instructions given on the official website are capable enough to break down the morale of any newbie who wants to get started.  Follow the instructions
mentioned below to setup theano on Ubuntu.

After you have successfully setup cuda on your system you need to follow these instructions to install and integrate your Nvidia GPU with theano.
Please follow the instructions for theano installation:-
$sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
$sudo pip install Theano

After installation following paths are to be added in the bashrc file

$gedit ~/.bashrc

Add these paths at the end of the bashrc file-

(Make sure you check your cuda version and edit it accordingly in these path definations)
export PATH=$PATH:/usr/local/cuda-6.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-6.0/lib64
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda-6.0/lib64
Following instructions  need to be added in theanorc file
Instruction :-
$gedit ~/.theanorc
floatX = float32
device = gpu
root =/usr/local/cuda-6.0/cuda
fastmath = True
ldflags = -lopenblas
Once installation is done testing of theano on GPU can be done from the following code:-
Instruction :-
Copy and paste the following code in python interpreter to test if GPU is integrated with theano.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s