一尘不染

如何在Windows 7 64位上使用theano设置cuDnn

python

我已经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_include = 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:

>>>

有人可以帮助我吗?谢谢。


阅读 145

收藏
2020-12-20

共1个答案

一尘不染

应该有一种方法可以通过仅设置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 \

在那之后它应该工作。

2020-12-20