TensorFlow on Windows: "Couldn't open CUDA library cudnn64_5.dll"

Alex picture Alex · Dec 7, 2016 · Viewed 47.6k times · Source

Tensorflow just released windows support. I installed the gpu version and CUDA 8.0 and python 3.5. However, after I import the tensorflow I got the following error:

>>> import tensorflow
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cublas64_80.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cudnn64_5.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:3459] Unable to load cuDNN DSO
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cufft64_80.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library nvcuda.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library curand64_80.dll locally

Can someone help? Thanks!

Answer

mrry picture mrry · Dec 7, 2016

TL;DR: To use cuDNN with TensorFlow, the file cudnn64_5.dll must be in a directory that is in your %PATH% environment variable. Note that cuDNN is a separate download from CUDA, and you must download version 5.1 of cuDNN.

First of all, note that cuDNN is not distributed with the rest of the CUDA toolkit, so you will need to download it separately from the NVIDIA website. On Windows, it is distributed as a ZIP archive, so you must extract it and find the directory containing cudnn64_5.dll. For example, if you extract it to C:\tools\cuda, the DLL will be in C:\tools\cuda\bin\cudnn64_5.dll. Finally, you can add it to your path by typing the following at the command prompt:

C:\> set PATH=%PATH%;C:\tools\cuda\bin
C:\> python
...
>>> import tensorflow as tf