Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: cudnn.h: No such file or directory #2

Open
billpage opened this issue Jan 18, 2018 · 2 comments
Open

fatal error: cudnn.h: No such file or directory #2

billpage opened this issue Jan 18, 2018 · 2 comments
Assignees
Labels

Comments

@billpage
Copy link

The following test for GPU functionality from the Theano tutorial:

import os
os.environ["MKL_THREADING_LAYER"] = "GNU"
os.environ["THEANO_FLAGS"] = "device=cuda,floatX=float32"
from theano import function, config, shared, tensor
import numpy
import time

vlen = 10 * 30 * 768  # 10 x #cores x # threads per core
iters = 1000

rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], tensor.exp(x))
print(f.maker.fgraph.toposort())
t0 = time.time()
for i in range(iters):
    r = f()
t1 = time.time()
print("Looping %d times took %f seconds" % (iters, t1 - t0))
print("Result is %s" % (r,))
if numpy.any([isinstance(x.op, tensor.Elemwise) and
              ('Gpu' not in type(x.op).__name__)
              for x in f.maker.fgraph.toposort()]):
    print('Used the cpu')
else:
    print('Used the gpu')

Produces an error message:

Can not use cuDNN on context None: cannot compile with cuDNN. We got this error:
/tmp/try_flags_cgM6mq.c:4:19: fatal error: cudnn.h: No such file or directory
 #include <cudnn.h>
                   ^
compilation terminated.

Mapped name None to device cuda: GeForce GTX 980 Ti (0000:01:00.0)

Although the output indicates that the GPU was in fact used during the execution

[GpuElemwise{exp,no_inplace}(<GpuArrayType<None>(float32, vector)>), HostFromGpu(gpuarray)(GpuElemwise{exp,no_inplace}.0)]
Looping 1000 times took 1.333771 seconds
Result is [ 1.23178029  1.61879349  1.52278066 ...,  2.20771813  2.29967761
  1.62323296]
Used the gpu
@billpage
Copy link
Author

Work-round:

Create a file named .theanorc in the project directory with the following contents:

[global]
floatX = float32
device = cuda

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

@ktaletsk
Copy link
Owner

ktaletsk commented Feb 1, 2018

@billpage I just had the same error when testing Theano and adding .theanorc helps. cuDNN is installed in a weird location. Need to find the way to preload .theanorc to the project folders.

@ktaletsk ktaletsk added the bug label Feb 1, 2018
@ktaletsk ktaletsk self-assigned this Feb 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants