Install TensorFlow with GPU support on Windows

To install TensorFlow with GPU support, the prerequisites are Python 3.5, CUDA 9.0, cuDNN v7.0 and finally a GPU with compute power 3.5 or more. Note that the versions of softwares mentioned are very important. Any deviation may result in unsuccessful installation of TensorFlow with GPU support. In this tutorial, we have used NVIDIA GEFORCE GTX 1060 having a compute power of 6.1.

  1. Install Python 3.5

    This version may not be the latest of Python, but you have to install Python 3.5 for TensorFlow to work. Link : [https://www.python.org/downloads/release/python-350/] Under Files section, choose a proper version for your OS bit version and download the executable. Run the exe, choose to add location to PATH in the first step of installation wizard. Continue with the default options. Python 3.5 should be successfully installed.

  2. Install CUDA 9.0.

    CUDA 9.0 is not the latest. So you may have to go to Legacy Releases. Link : [https://developer.nvidia.com/cuda-90-download-archive] Select your Operating System and OS Version. Select Installer type as Local. Download Base Installer and all the available Patches. First install the Base using Base Installer and then install the patches in the numeric order (In the order of Patch 1, Patch 2, Patch 3).

  3. Install cuDNN v7.0

    First you have to signup for NVIDIA Developer Account. Link : https://developer.nvidia.com/cudnn There would be quick survey. Finish it. Once the signup is successful, you can download cuDNN v7.0 for CUDA 9.0 at [https://developer.nvidia.com/rdp/cudnn-archive#a-collapse705-9]. Also open installation guide present at [https://developer.nvidia.com/compute/machine-learning/cudnn/secure/v7.0.5/prod/Doc/cuDNN-Installation-Guide]. Follow the steps under Windows section. It would be mostly a copying files to the respective installation directory of NVIDIA GPU Computing Toolkit.

  4. Install TensorFlow for GPU.

    Once all the above three prerequisites are installed successfully, now the final step in the installations is to install TensorFlow itself. There are two ways to install TensorFlow for GPU. You can use either Anaconda IDE or pip (which is already with python). We shall go with pip. Open command prompt and run the following command.

    Install TensorFlow for GPU

  5. Verify TensorFlow Installation

    The final step in setting up TensorFlow for GPU is verification. To verify if the installation is successful, open python shell and run the following python instructions one by one.

    TensorFlow Installation for GPU - VerificationObserve in the debug lines of creating a tensorflow session, TensorFlow device has been created which is physical GPU (GeForce GTX 1060).

Conclusion

In this Deep Learning Tutorial, we have gone through the steps to install all the prerequisites of and TensorFlow for GPU.