Install Gpu Version of Tensorflow under Windows System
- Created on Thur. Jul 11 10:20:30 2018
- author: Jian Cao
- email:[email protected]
Step 1. Create a runtime environment for python 3.5
Press Win + R
Type ‘cmd’
Type ‘conda create -n tensorflow python=3.5’
Note: You need to install anaconda first (version: anaconda 4.1.0; python 3.5.1).
The installation address is :
https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/Anaconda3-4.1.0-Windows-x86_64.exe
Step 2. Install TensorFlow
Type ‘activate tensorflow’
Type ‘pip install tensorflow-gpu==1.0.1’
Note: If you fail to install tensorflow-gpu in the previous step, you can download the installation package.
The installation address is :
https://mirrors.tuna.tsinghua.edu.cn/tensorflow/windows/gpu/tensorflow_gpu-1.0.1-cp35-cp35m-win_amd64.whl
Then go to the path of the package:
Type ‘cd \Users\XXX\Downloads’
Then install tensorflow:
Type ‘pip install tensorflow_gpu-1.0.1-cp35-cp35m-win_amd64.whl’
Step 3. Install CUDA (Version: 8.0)
The installation address is:
https://developer.nvidia.com/CUDA-80-download-archive
Choose ‘Windows’, ‘x86_64’, ‘10’, ‘exe(local)’, then download the installation package.
Step 4. Install CUDNN
The installation address is :
https://developer.nvidia.com/rdp/CUDNN-archive
Choose ‘Download CUDNN v5.1 (Jan 20, 2017), for CUDA 8.0’, ‘CUDNN v5.1 Library for Windows 10’.
Decompress it and copy three subfolders named ‘bin’, ‘include’ and ‘lib’.
Paste those three subfolders in the installation directory of CUDA.
(.\ NVIDIA GPU Computing Toolkit\CUDA\v8.0)
Step 5. Test whether tensorflow-gpu is installed successfully
Press Win + R
Type ‘cmd’
Type ‘python’
Type
import tensorflow as tf
matrix1 = tf.constant([[3., 3.]])
matrix2 = tf.constant([[2.],[2.]])
product = tf.matmul(matrix1, matrix2)
sess = tf.Session()
Note: Tensorflow-gpu is installed successfully if the output contains your graphics card information.
Reference : https://blog.csdn.net/hdd0411/article/details/71305931