Tensorflow GPU Installation

by Nian Li

Posted on November 9, 2018

Tensorflow is a robust tool for training artificial intelligence model. However, compared to tensorflow CPU version, GPU version is much more powerful. Hence, tensorflow GPU version installation is crucial for developers with large training tasks.

Reference: Tensorflow Installation Tensorflow GPU Support

1. Download Microsoft Visual Studio (Skip this step if you alread have it installed)

  • Download Microsoft visual studio IDE. 2017 community version should be fine.
  • During Installation process, select Visual c++ in Development Settings.
  • Note: If you do not have it installed and skip to the next step to install GPU driver directly, it will remind you have no Visual Studio installed during checking environment process.

2. Download GPU Driver

GPU Driver

3. Download CUDA Toolkit

  • Go CUDA Download Page and click Legacy Releases. Do NOT download the latest 10.0 version as tensorflow currently only supports 9.0 version.
  • Find 9.0 version and install the driver

4. Download cuDNN SDK


  • Download cuDNN on cuDNN Download Page. You may need to register an account in order to download it.
  • Find 9.0 version and download cuDNN SDK
  • Extract SDK into a folder.

5. Add Path to Environment Variable


  • Add 3 paths in Environment Variable. In graph above, three paths correspond to NVIDIA GPU drivers, CUDA Toolkit and cuDNN SDK respectively. While the previous 2 paths are by default.

6. Download tensorflow gpu version

For windows users, open a command window and type following commands in sequence: (please refer to Tensorflow Installation at the top of this page)

  • pip install tensorflow-gpu
  • python -c "import tensorflow as tf; tf.enable_eager_execution(); print(tf.reduce_sum(tf.random_normal([1000, 1000])))"

First command is to install tensorflow GPU version and second command is to test whether installation is successful or not. If you see following outputs, it means you install it successfully.

GPU test

Tutorial Topic Youtube
Tensorflow GPU Version Installation Install and check tensorflow GPU version