2017年7月13日 星期四

Setup TensorFlow with GPU support on Windows

TensorFlow with GPU support brings higher speed for computation than CPU-only. But, you need some additional settings especially for CUDA. First of all, we need to follow the guideline from https://www.tensorflow.org/install/install_windows. TensorFlow on Windows currently only has Python 3 support, I suggest to use python 3.5.3 or below. Then, install CUDA 8.0 and download cuDNN v5.1. In terms of cuDNN, please use v5.1 instead of v6.0. I used to try to setup my TensorFlow with cuDNN v6.0 for a couple of days, it doesn't work and takes me a lot of time :( .

Then, move the files from cuDNN v5.1 that you already download to the path where you installed CUDA 8.0, like "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0", following the steps as below:

cudnn-8.0-windows10-x64-v5.1\cuda\bin\cudnn64_5.dll -----------------CUDA\v8.0\bin
cudnn-8.0-windows10-x64-v5.1\cuda\include\cudnn.h------------------------CUDA\v8.0\include
cudnn-8.0-windows10-x64-v5.1\cuda\lib\x64\cudnn.lib-----------------------CUDA\v8.0\lib\x64

Don't need to add the folder path of cudnn-8.0-windows10-x64-v5.1 to your %PATH%. Now, we can start to confirm our installation is ready.

Steps:
1. Create a virtualenv under your working folder:
virtualenv --system-site-packages tensorflow
2. Activate it
tensorflow\Scripts\activate
It shows (tensorflow)$
3. Install TensorFlow with GPU support
pip3 install --upgrade tensorflow-gpu
4. Import TensorFlow to confirm it is ready
(tensorflow) %YOUR_PATH%\tensorflow>python
Python 3.5.2 [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>>

If it doesn't show anything, that means it works.
But, if you see error messages like, No module named '_pywrap_tensorflow_internal', you can take a look at issue 9469, 7705. It should be the cudnn version problem or cudnn can't be found. Please follow the method that I mentioned above.

 
 
 

沒有留言:

張貼留言