Lucas Azevedo
Lucas Azevedo

Reputation: 2370

cuDNN path not resolving

I'm trying to run the this theano test and I'm having problems with my cudnn path. I remember passing the tests after installing cudnn but it seems that theano cannot find the path to cudnn. Is this an enviroment variable problem? Does anyone have a solution for it?

whereis cuda

gives me

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

Running the test with THEANO_FLAGS=device=cuda0 MKL_THREADING_LAYER=GNU python test.py gives me

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

Upvotes: 0

Views: 2002

Answers (1)

Lucas Azevedo
Lucas Azevedo

Reputation: 2370

As the error sugested, I had to include the cudnn path in the THEANO FLAGS.

That can be done in two ways:

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

or

(2) including in the theano config file ~/.theanorc the following lines:

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

I hope this helps someone else.

Upvotes: 1

Related Questions