This is going to be a tutorial on how to install tensorflow GPU on Windows OS. We will be installing tensorflow 1.5.0 along with CUDA Toolkit 9.1 and cuDNN 7.0.5. At the time of writing this blog post, the latest version of tensorflow is 1.5.0. We also did the installation guide for tensorflow 1.5.0 GPU on ubuntu 16.04 which you can find in this post here. This tutorial is for building tensorflow from source. If you want to use the official pre-built pip package instead, I recommend another post, How to install Tensorflow 1.5.0 using official pip package. If you want to install tensorflow alongside CUDA 10.0, I highly recommend our other article, How to install Tensorflow GPU with CUDA 10.0 for python on Windows.
Tensorflow is an open source software library developed and used by Google that is fairly common among students, researchers, and developers for deep learning applications such as neural networks. It has both the CPU as well as GPU version available and although the CPU version works quite well, realistically, if you are going for deep learning, you will need GPU. In order to use the GPU version of TensorFlow, you will need an NVIDIA GPU with a compute capability > 3.0.
To install tensorflow GPU on Windows is complicated especially when compared to Mac or Linux OS. Even the tensorflow’s official website states, “We don’t officially support building TensorFlow on Windows; however, you may try to build TensorFlow on Windows if you don’t mind using the highly experimental Bazel on Windows or TensorFlow CMake build.” However, here is a complete step by step working tutorial to install Tensorflow GPU on Windows (64-bit only) OS using Visual Studio 2015 Update 3 and CMake.
The steps you need to take in order to install Tensorflow GPU on Windows OS are as follows:
Step 1: Verify you have a CUDA-Capable GPU:
Before doing anything else, you need to verify that you have a CUDA-Capable GPU in order to install Tensorflow GPU. You can verify that you have a CUDA-capable GPU through the Display Adapters section in the Windows Device Manager. Here you will find the vendor name and model of your graphics card(s).
The Windows Device Manager can be opened via the following steps:
Open a run window from the Start Menu or (Win+R)
control /name Microsoft.DeviceManager
If your graphics card is from NVIDIA then go to http://developer.nvidia.com/cuda-gpus and verify if listed in CUDA enabled GPU list.
Note down its Compute Capability. eg. GeForce 840M 5.0
Step 2: Install Visual Studio 2015 Update 3:
You will need Visual Studio 2015 in order to install tensorflow GPU on Windows. We tried installing with Visual Studio 2017 but it seems as if currently, Visual Studio 2017 is not fully supported to build tensorflow-gpu from source. So we recommend installing Visual Studio 2015 Update 3 by going to https://my.visualstudio.com/Downloads (Sign In required with Developer Account). Search for “Visual Studio Community 2015 with Update 3”. Download x64 version.
Goto Custom installation and make sure to install Visual C++ and Python Tools for Visual Studio inside Programming Language. Finish Installation.
Step 3: Download the NVIDIA CUDA Toolkit:
Go to https://developer.nvidia.com/cuda-downloads and download Installer for Windows [your version][network]. For me, version is Windows 10. We recommend network installer.
Install it in default location with default settings. It will update your GPU driver if required.
Step 4: Reboot the system to load the NVIDIA drivers.
Step 5: Check Cuda Toolkit is set to path:
Go to run (Win + R) type cmd
The following command will check for nvcc version and insure that it is set in path environment variable.
You will see something like:
nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2017 NVIDIA Corporation Built on Fri_Nov__3_21:08:12_Central_Daylight_Time_2017 Cuda compilation tools, release 9.1, V9.1.85
Step 6: Install cuDNN 7.0.5:
Goto https://developer.nvidia.com/cudnn (Membership required)
Download the following:
cuDNN v7.0.5 Library for Windows [your version] for me Windows 10
Goto downloaded folder and extract cudnn-9.1-windows[your version]-x64-v7.zip
Go inside extracted folder and copy all files and folder from cuda folder (eg. Bin, include, lib) and paste to “C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1”.