10

I have installed Theano framework and enabled CUDA on my machine, however when I "import theano" in my python console, I got the following message:

>>> import theano
Using gpu device 0: GeForce GTX 950 (CNMeM is disabled, CuDNN not available)

Now that "CuDNN not available", I downloaded cuDnn from Nvidia website. I also updated 'path' in environment, and added 'optimizer_including=cudnn' in '.theanorc.txt' config file.

Then, I tried again, but failed, with:

>>> import theano
Using gpu device 0: GeForce GTX 950 (CNMeM is disabled, CuDNN not available)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Anaconda2\lib\site-packages\theano\__init__.py", line 111, in <module>
    theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1()
  File "C:\Anaconda2\lib\site-packages\theano\sandbox\cuda\tests\test_driver.py", line 31, in test_nvidia_driver1
    profile=False)
  File "C:\Anaconda2\lib\site-packages\theano\compile\function.py", line 320, in function
    output_keys=output_keys)
  File "C:\Anaconda2\lib\site-packages\theano\compile\pfunc.py", line 479, in pfunc
    output_keys=output_keys)
  File "C:\Anaconda2\lib\site-packages\theano\compile\function_module.py", line 1776, in orig_function
    output_keys=output_keys).create(
  File "C:\Anaconda2\lib\site-packages\theano\compile\function_module.py", line 1456, in __init__
    optimizer_profile = optimizer(fgraph)
  File "C:\Anaconda2\lib\site-packages\theano\gof\opt.py", line 101, in __call__
    return self.optimize(fgraph)
  File "C:\Anaconda2\lib\site-packages\theano\gof\opt.py", line 89, in optimize
    ret = self.apply(fgraph, *args, **kwargs)
  File "C:\Anaconda2\lib\site-packages\theano\gof\opt.py", line 230, in apply
    sub_prof = optimizer.optimize(fgraph)
  File "C:\Anaconda2\lib\site-packages\theano\gof\opt.py", line 89, in optimize
    ret = self.apply(fgraph, *args, **kwargs)
  File "C:\Anaconda2\lib\site-packages\theano\gof\opt.py", line 230, in apply
    sub_prof = optimizer.optimize(fgraph)
  File "C:\Anaconda2\lib\site-packages\theano\gof\opt.py", line 89, in optimize
    ret = self.apply(fgraph, *args, **kwargs)
  File "C:\Anaconda2\lib\site-packages\theano\sandbox\cuda\dnn.py", line 2508, in apply
    dnn_available.msg)
AssertionError: cuDNN optimization was enabled, but Theano was not able to use it. We got this error:
Theano can not compile with cuDNN. We got this error:

>>>

anyone can help me? Thanks.

thor
  • 21,418
  • 31
  • 87
  • 173
Tyler Xie
  • 169
  • 1
  • 3
  • 13
  • try to update your theano version? – malioboro Mar 29 '16 at 20:44
  • Possible duplicate of [How do I install theano in Anaconda ver. 2.1 Windows 64 bit for Python 3.4?](http://stackoverflow.com/questions/27629347/how-do-i-install-theano-in-anaconda-ver-2-1-windows-64-bit-for-python-3-4) – devinbost Feb 13 '17 at 22:00

2 Answers2

34

There should be a way to do it by setting only the Path environment variable but I could never get that to work. The only thing that worked for me was to manually copy the CuDNN files into the appropriate folders in your CUDA installation.

For example, if your CUDA installation is in C:\CUDA\v7.0 and you extracted CuDNN to C:\CuDNN you would copy as follows:

  • The contents of C:\CuDNN\lib\x64\ would be copied to C:\CUDA\v7.0\lib\x64\
  • The contents of C:\CuDNN\include\ would be copied to C:\CUDA\v7.0\include\
  • The contents of C:\CuDNN\bin\ would be copied to C:\CUDA\v7.0\bin\

After that it should work.

Alexander Measure
  • 894
  • 1
  • 14
  • 18
  • Oh, it works! In my case, I copied \bin too. Thank you very much!! – greentec Apr 11 '16 at 14:30
  • 9
    Using CUDA 7.5 and CUDNN 5. The location of CUDA is `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5`. In addition to copying the `lib` and `include` directory I also had to copy a dll from the `bin` directory. Then it worked (after I switched to the Theano master branch because the 0.8.1 release is older than CUDNN 5). – Joels Elf Apr 15 '16 at 19:43
  • Note that cuDNN needs a GPU which is Kepler (Compute Capability 3.0) or later. e.g. a Quadro 5000 will only support CNMeM, and not cuDNN. – casper.dcl May 03 '17 at 17:07
  • Got it working with CUDA 8.0, cuDNN 5.1 and Windows 10 64-bit with tensorflow 1.1. I also couldn't get it working adding directory to path. Man send me your address, I'll send you a beer, few hours of fight... – Grysik May 08 '17 at 21:28
-4

In addition to all the stuffs you did I updated following content of .theanorc.txt in my home folder and it worked after that.

[lib] 
#cnmem=1.0 
cudnn=1.0
0xF
  • 546
  • 4
  • 20