Theano: Cannot use cudnn.

Created on 15 Apr 2017  Â·  8Comments  Â·  Source: Theano/Theano

Hi, I need help.

I install cuda 8.0 cudnn 5.1 on a ubuntu 14.04 machine, theano complain

Can not use cuDNN on context None: cannot compile with cuDNN. We got this error:
In file included from /usr/local/cuda-8.0/include/channel_descriptor.h:62:0,
                 from /usr/local/cuda-8.0/include/cuda_runtime.h:90,
                 from /usr/include/cudnn.h:64,
                 from /tmp/try_flags_F2eFMF.c:4:
/usr/local/cuda-8.0/include/cuda_runtime_api.h:1628:101: error: use of enum ‘cudaDeviceP2PAttr’ without previous declaration
 extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetP2PAttribute(int *value, enum cudaDeviceP2PAttr attr, int srcDevice, int dstDevice);
                                                                                                     ^
In file included from /usr/local/cuda-8.0/include/channel_descriptor.h:62:0,
                 from /usr/local/cuda-8.0/include/cuda_runtime.h:90,
                 from /usr/include/cudnn.h:64,
                 from /tmp/try_flags_F2eFMF.c:4:
/usr/local/cuda-8.0/include/cuda_runtime_api.h:2220:160: error: ‘cudaMemAttachSingle’ was not declared in this scope
 extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaStreamAttachMemAsync(cudaStream_t stream, void *devPtr, size_t length __dv(0), unsigned int flags __dv(cudaMemAttachSingle));
                                                                                                                                                                ^
/usr/local/cuda-8.0/include/cuda_runtime_api.h:3030:123: error: ‘cudaMemAttachGlobal’ was not declared in this scope
 extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaMallocManaged(void **devPtr, size_t size, unsigned int flags __dv(cudaMemAttachGlobal));
                                                                                                                           ^
In file included from /usr/local/cuda-8.0/include/channel_descriptor.h:62:0,
                 from /usr/local/cuda-8.0/include/cuda_runtime.h:90,
                 from /usr/include/cudnn.h:64,
                 from /tmp/try_flags_F2eFMF.c:4:
/usr/local/cuda-8.0/include/cuda_runtime_api.h:5382:92: error: use of enum ‘cudaMemoryAdvise’ without previous declaration
 extern __host__ cudaError_t CUDARTAPI cudaMemAdvise(const void *devPtr, size_t count, enum cudaMemoryAdvise advice, int device);
                                                                                            ^
/usr/local/cuda-8.0/include/cuda_runtime_api.h:5438:98: error: use of enum ‘cudaMemRangeAttribute’ without previous declaration
 extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttribute(void *data, size_t dataSize, enum cudaMemRangeAttribute attribute, const void *devPtr, size_t count);
                                                                                                  ^
/usr/local/cuda-8.0/include/cuda_runtime_api.h:5474:102: error: use of enum ‘cudaMemRangeAttribute’ without previous declaration
 extern __host__ cudaError_t CUDARTAPI cudaMemRangeGetAttributes(void **data, size_t *dataSizes, enum cudaMemRangeAttribute *attributes, size_t numAttributes, const void *devPtr, size_t count);
                                                                                                      ^
In file included from /usr/include/cudnn.h:64:0,
                 from /tmp/try_flags_F2eFMF.c:4:
/usr/local/cuda-8.0/include/cuda_runtime.h:453:26: error: ‘cudaMemAttachGlobal’ was not declared in this scope
   unsigned int   flags = cudaMemAttachGlobal
                          ^
/usr/local/cuda-8.0/include/cuda_runtime.h:533:27: error: ‘cudaMemAttachSingle’ was not declared in this scope
   unsigned int   flags  = cudaMemAttachSingle
                           ^


looks like some kind of gcc standard conflict, should I upgrade my gcc ? if so, to what ?

Most helpful comment

@guoxuesong ,

Open the file:
/usr/include/cudnn.h

And try change the line:

include "driver_types.h"

to:

include

All 8 comments

Which GCC version do you use ? There are some GCCs that don't work and a fix is underway. https://github.com/Theano/Theano/issues/5845 . If your GCC version is one of them, downgrade to a lower version.

@Sentient07 It's the default one

ubuntu@ubuntu:~$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Which Theano flags do you use? Do you use device=cuda* or device=gpu*?

We got rid in the master of Theano of the old back-end (device=gpu). If you still use it, I strongly suggest that you use the new back-end: https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29

We don't have time to help with the old back-end. If the problem is with the new back-end, we want to fix this.

@guoxuesong ,

Open the file:
/usr/include/cudnn.h

And try change the line:

include "driver_types.h"

to:

include

as no news and we can't reproduce it, I'll close. If someone still have this problem with the new back-end, tell us.

I just wanted to comment I had same issue installing CAFFE on Ubuntu 16.04 LTS / Cuda 8.0.61_375.26 and the solution above worked for me as well. Thank you.

Sorry, I forgot to report the result, @kadok is right, some prev install of other version of cudnn leave a extra driver_types.h in my directory.

Caffe Installation on Ubuntu 16.04 LTS / Cuda 8.0 hit solution worked for me as well

Was this page helpful?
0 / 5 - 0 ratings