Training neural networks can be a computationally and a time expensive task because they can depend on calculating the gradients of thousands or even millions of parameters. In recent years there have been advancements in multi-core processing with multi-core cpu (central processing units) which can help speed up the process.

 

But even though we can take advantage of the multi-core processing, most cpus only have either 4 or 8 cores. Fortunately we use utilize the thousands of cores available on graphic processing units to speed up our neural network training process.

 

gpu cpu1

 

 

 

 

 

 

 

For example, lets compare the GTX 980 TI graphic processing unit to the Intel Core i7-6700K 8M Skylake cpu . The GTX 980 TI has 704x time more physical cores then the cpu. Unfortunately, writing code to run on the gpu is not a trivial task. This is where libraries like Theano can help. Theano is a python library that translate python code into code which can be run on the gpu.

 

Since Theano is still in development, it is not user friendly and not easy to install. The goal of this post is to serve as a concise and updated tutorial on how to get Theano working on Windows 10 using the gpu.

 

For the remainder of this tutorial I am going to assume that most of your python libraries are installed through the python distribution known as MiniConda.
Link : https://www.continuum.io/downloads
Install Visual Studio
https://www.visualstudio.com/en-us/news/releasenotes/vs2013-community-vs
Install Miniconda (includes Python)

conda install pip six nose numpy scipy

 

Install CUDA Toolkit

https://developer.nvidia.com/cuda-downloads

 

conda install mingw libpython

pip install theano

 

Add a new system variable to environment variables with variable name THEANO_FLAGS and variable value

 

floatX=float32,device=gpu,nvcc.fastmath=True

 

Confirm that C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\ is in the PATH variable, if not add it.

Theano should now be able to run the code on GPU.

Run python and import theano. If you see the following message then it means that the installation was correctly done.

 

 

 

This is confirmed to work on Windows 10 version 14393.576 with Cuda 7.5.