【问题标题】:cuDNN path not resolvingcuDNN 路径无法解析
【发布时间】:2018-06-20 13:32:49
【问题描述】:

我正在尝试运行 this theano test,但我的 cudnn 路径有问题。我记得在安装 cudnn 后通过了测试,但似乎 theano 找不到 cudnn 的路径。这是环境变量问题吗?有人有解决办法吗?

whereis cuda

给我

cuda: /usr/include/cuda.h /usr/local/cuda

用THEANO_FLAGS=device=cuda0 MKL_THREADING_LAYER=GNU python test.py 运行测试给了我

ERROR (theano.gpuarray): Could not initialize pygpu, support disabled
Traceback (most recent call last):
  File "/home/lucas/miniconda2/lib/python2.7/site-packages/theano/gpuarray/__init__.py", line 220, in <module>
    use(config.device)
  File "/home/lucas/miniconda2/lib/python2.7/site-packages/theano/gpuarray/__init__.py", line 207, in use
    init_dev(device, preallocate=preallocate)
  File "/home/lucas/miniconda2/lib/python2.7/site-packages/theano/gpuarray/__init__.py", line 110, in init_dev
    context.cudnn_handle = dnn._make_handle(context)
  File "/home/lucas/miniconda2/lib/python2.7/site-packages/theano/gpuarray/dnn.py", line 124, in _make_handle
    cudnn = _dnn_lib()
  File "/home/lucas/miniconda2/lib/python2.7/site-packages/theano/gpuarray/dnn.py", line 111, in _dnn_lib
    config.dnn.base_path)
RuntimeError: Could not load cudnn library. Check your cudnn installation. Maybe using the Theano flag dnn.base_path can help you. Current value "/usr"
[Elemwise{exp,no_inplace}(<TensorType(float64, vector)>)]
Looping 1000 times took 3.294467 seconds
Result is [1.23178032 1.61879341 1.52278065 ... 2.20771815 2.29967753 1.62323285]
Used the cpu

【问题讨论】:

    标签: python theano cudnn theano-cuda


    【解决方案1】:

    由于错误提示,我必须在 THEANO FLAGS 中包含 cudnn 路径。

    这可以通过两种方式完成:

    (1) 内联:THEANO_FLAGS="device=cuda0, dnn.base_path=/usr/local/cuda" MKL_THREADING_LAYER=GNU python test.py

    或

    (2) 在theano 配置文件~/.theanorc 中包含以下几行:

    [dnn]
    include_path = /usr/lib/cuda/include
    library_path = /usr/lib/cuda/lib64
    

    我希望这对其他人有帮助。

    【讨论】:

      猜你喜欢
      • 2019-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-15
      • 2014-11-28
      • 2019-08-18
      • 2021-03-31
      相关资源
      最近更新 更多