10

我已经在我的机器上安装了Theano框架并启用了 CUDA,但是当我在我的 python 控制台中“导入 theano”时,我收到了以下消息:

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

现在“CuDNN 不可用”,我cuDnn从 Nvidia 网站下载。我还更新了环境中的“路径”,并在“.theanorc.txt”配置文件中添加了“optimizer_including=cudnn”。

然后,我再次尝试,但失败了:

>>> 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:

>>>

任何人都可以帮助我吗?谢谢。

4

2 回答 2

34

应该有一种方法可以通过仅设置 Path 环境变量来做到这一点,但我永远无法让它工作。唯一对我有用的是手动将 CuDNN 文件复制到 CUDA 安装中的适当文件夹中。

例如,如果您的 CUDA 安装在 C:\CUDA\v7.0 中,并且您将 CuDNN 解压缩到 C:\CuDNN,您将复制如下:

  • C:\CuDNN\lib\x64\ 的内容将被复制到 C:\CUDA\v7.0\lib\x64\
  • C:\CuDNN\include\ 的内容将被复制到 C:\CUDA\v7.0\include\
  • C:\CuDNN\bin\ 的内容将被复制到 C:\CUDA\v7.0\bin\

之后它应该工作。

于 2016-04-07T01:10:01.137 回答
-4

除了您所做的所有事情之外,我还在我的主文件夹中更新了 .theanorc.txt 的以下内容,之后它就起作用了。

[lib] 
#cnmem=1.0 
cudnn=1.0
于 2016-09-15T14:42:00.797 回答