I guess better late than never. So, here's how to setup the GPU version of TensorFlow on Windows.
So, what do you need to get TensorFlow working on GPU?
You need to setup the following prerequisites, in that order.
- Microsoft Visual Studio 2015 (The free community edition of VS 2015 will work)
- CUDA 8.0
- cuDNN 5.1 for CUDA 8.0
Visual Studio 2015 installed with C++ |
Then, get CUDA 8.0 and cuDNN 5.1 for CUDA 8.0 (click on the links to go to the downloads pages).
Downloading CUDA 8.0 |
Downloading cuDNN 5.1 for CUDA 8.0 |
Deselect the GeForce Experience and Display Driver components |
Extracting cuDNN |
Now you are ready to install TensorFlow.
Start by creating an Anaconda environment for TensorFlow and activate it.
conda create --name tensorflow numpy scipy scikit-learn pillow h5py mingw libpython
activate tensorflow
Then, we install TensorFlow GPU package from pip. We install it in 2 steps to avoid messing up the conda installed packages (explained in my earlier post)
pip install --upgrade --no-deps https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.1-cp35-cp35m-win_amd64.whl
pip install https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-1.0.1-cp35-cp35m-win_amd64.whl
Let's run a sample TensorFlow commands to see if the installation is successful.
python
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
>>> print(sess.run(hello))
Hello, TensorFlow!
>>> a = tf.constant(10)
>>> b = tf.constant(32)
>>> print(sess.run(a + b))
If all goes well, you will see that TensorFlow recognizes your GPU and create a TensorFlow device on it.
TensorFlow running on GPU |
Related Posts:
Setting up TensorFlow on Windows
Build Deeper: Deep Learning Beginners' Guide is the ultimate guide for anyone taking their first step into Deep Learning.
Get your copy now!
No comments:
Post a Comment