-
Notifications
You must be signed in to change notification settings - Fork 8
Theano Installation
Theano
is a Python
library that enables using a compatible GPU (Graphical Processing Unit) of the computer for numerical computation, which is far superior in performance terms to computation by the computer’s CPU (Central Processing Unit).
-
Currently, the most, if not only, effectively
Theano
-supported GPUs are those by NVIDIA; - Even if your machine do not have an NVIDIA graphics card,
Theano
is still useful in compiling complex calculations down to highly efficient C / C++ or machine code that can execute very fast.  Because of its huge performance-boosting benefits,Theano
is prominent in extremely data-intensive, large-scale Machine Learning applications such as those in cutting-edge Neural Networks-based Deep Learning.
Having said that, Theano
is still very young ("young" = nice word for "buggy") and its setup, configuration and usage demand a high degree of risk-taking and perseverance. :( (It helps if you are good with your friends and hence enjoy good karma)
You may refer to the Theano
installation and configuration guide for Mac here.
Appropriate steps vary from machine to machine. Consult Dr. Google and Prof. Stack Overflow whenever you get stuck. In our own experience, the recommended key steps include:
-
Install the
Anaconda Python
v2.7 distribution; -
Install the
CLang
compiler through installing theXCode
app VERSION 6.2 from the Apple Developer site and runningXCode
once to install its command-line tools;-
if you have
Xcode
version >6.2, uninstall / delete it and install v6.2; - copy the app to the
/Applications
folder and rename it "Xcode_6.2.app
";
-
if you have
-
Install the CUDA graphics driver and toolkit v7.5 from NDIVIA in order to use the GPU to perform numerical computation;
- CUDA Toolkit installation manual here;
- add the following to the
.bash_profile
file in your home folder:export PATH=/Developer/NVIDIA/CUDA-7.5/bin:$PATH
export DYLD_LIBRARY_PATH=/Developer/NVIDIA/CUDA-7.5/lib:$DYLD_LIBRARY_PATH
-
Download this template
.theanorc
file for Mac to the/Users/<Your-Username-On-Your-Mac-Machine>/
home folder, and customize it where necessary -
Restart your machine for changes to take effect
You may refer to the Theano installation and configuration guide for Windows here.
Appropriate steps vary from machine to machine. Consult Dr. Google and Prof. Stack Overflow whenever you get stuck. In our own experience, the recommended key steps include:
-
Install the
Anaconda Python
v2.7 distribution; -
Install the
MinGW
andLibPython
Python
packages by running the following command in a command-line terminal window:conda install MinGW LibPython
-
Find and install Visual Studio Community 2013; _ do NOT install the 2015 version, which is not compatible with the CUDA software below;
-
Install the CUDA graphics driver and toolkit v7.5 from NDIVIA in order to use the GPU to perform numerical computation;
-
Install a GNU C Compiler (GCC) package such as TMD-GCC, appropriate for your Windows machine's processor (32-bit / 64-bit);
-
Download this template
.theanorc
file for Mac to theC:/Users/<Your-Username-On-Your-Windows-Machine>/
home folder, and customize it where necessary 
Download this TheanoTestScript.py
file to your computer and run it with command python TheanoTestScript.py
in the corresponding folder.
Verify that it completes successfully, giving your a comparison of speeds between NumPy
and Theano
:
- if your machine does not have a compatible GPU, the two speeds should be similar
- if your machine does have a compatible GPU, for this small test, the
Theano
time may be slower than theNumPy
time because of data transfer overhead from and to the GPU;Theano
saves time for much larger operations