In case you missed it, TensorFlow is now available for Windows, as well as Mac and Linux. This was not always the case. For most of TensorFlow’s first year of existence, the only means of Windows support was virtualization, typically through Docker. Even without GPU support, this is great news for me. I teach a graduate course in deep learning and dealing with students who only run Windows was always difficult. Previously, I encouraged Windows students to either use Docker or the cloud. Now all will be able to run locally.

Using your GPU for deep learning is widely reported as highly effective. Clearly very high end GPU clusters can do some amazing things with deep learning. However, I was curious what deep learning could offer a high-end GPU that you might find on a laptop. Particularly, I was curious about my Windows Surface Book (GPU: GeForce GT 940) performance of using the GPU vs the CPU. Should I be using the GPU for my deep learning research? It turns out that I should be! For a simple example (see my class website), I got the following results:

CPU Version of TensorFlow: 1 hour, 54 minutes.
GPU Version of TensorFlow: 13 minutes.


The newer Surface Book’s have even more advanced GPU’s (GeForce GT 965). The TensorFlow playing field has really changed between Mac and Windows in the last year. When TensorFlow was first released (November 2015) there was no Windows version and I could get decent performance on my Mac Book Pro (GPU: NVidia 650M). Now, on the first day of 2017, the new Mac Book Pros are sporting a strange LCD touch bar (to replace function keys) and an AMD GPU. Both of which are useless to TensorFlow. At some point TensorFlow will probably add OpenCL support, and allow AMD chips to run. But, for now, NVidia CUDA is where most of the interesting developments are being made for deep learning.

I never thought I would say this a year ago, but the Microsoft Surface Book, is one of the best mainstream laptops for deep learning development. Of course, if you are willing to go outside the mainstream, there are more powerful options. Though, if you need extreme heavy lifting with GPU’s you should look to the cloud.

## Installing

First, you should make sure you have the correct NVidia drivers installed:

Installing TensorFlow into Windows Python is a simple pip command. As of the writing of this post, TensorFlow requires Python 2.7, 3.4 or 3.5. In my case I used Anaconda Python 3.5. Read here to see what is currently supported The first thing that I did was create CPU and GPU environment for TensorFlow. This keeps them separate from other non-deep learning Python environments that I have. To create my CPU TensorFlow environment, I used:

conda create --name tensorflow python=3.5
activate tensorflow
conda install jupyter
conda install scipy
pip install tensorflow


To create my CPU TensorFlow environment, I used:

conda create --name tensorflow-gpu python=3.5
activate tensorflow-gpu
conda install jupyter
conda install scipy
pip install tensorflow-gpu


Your TensorFlow code will not change using a single GPU. You can simply run the same code by switching environments. TensorFlow will either use the GPU or not, depending on which environment you are in. You can switch between environments with:

activate tensorflow
activate tensorflow-gpu


## Conclusions

If you are doing moderate deep learning networks and data sets on your local computer you should probably be using your GPU. Even if you are using a laptop. NVidia is the GPU of choice for scientific computing. While AMD might be fully capable, support for AMD is much more sparse.