Installing Caffe: 'cudaMemAttachGlobal' was not declared

Hi guys,

I’m running experiments on caffe, which was once successfully installed.
But recently, when I re-make caffe, I got error below with some analysis I did. but could not find out to fix…

-----------------Error Start--------------
haoran@ XXX:~/Caffe/Normal/caffe$ make all
CXX src/caffe/util/cudnn.cpp
In file included from /usr/include/cudnn.h:60:0,
from ./include/caffe/util/cudnn.hpp:5,
from src/caffe/util/cudnn.cpp:2:
/usr/local/cuda/include/cuda_runtime.h:327:26: error: ‘cudaMemAttachGlobal’ was not declared in this scope
unsigned int flags = cudaMemAttachGlobal
^
In file included from /usr/include/cudnn.h:60:0,
from ./include/caffe/util/cudnn.hpp:5,
from src/caffe/util/cudnn.cpp:2:
/usr/local/cuda/include/cuda_runtime.h:404:27: error: ‘cudaMemAttachSingle’ was not declared in this scope
unsigned int flags = cudaMemAttachSingle
-----------------Error Finish--------------

My analysis:

I’ve checked through /usr/local/cuda/include file. And I’ve found the definition of both ‘cudaMemAttachSingle(Global)’ at ‘driver_types.h’ file, which writes as :

#if !defined(CUDA_INTERNAL_COMPILATION)

.
.
.

#define cudaMemAttachGlobal 0x01 /< Memory can be accessed by any stream on any device*/
#define cudaMemAttachHost 0x02 /
< Memory cannot be accessed by any stream on any device */
#define cudaMemAttachSingle 0x04 /**< Memory can only be accessed by a single stream on the associated device */

#endif /* !CUDA_INTERNAL_COMPILATION */.

So the problem turns into unexpected definition of CUDA_INTERNAL_COMPILATION, which is found at “crt/host_runtime.h”. But then I cannot find a single sentence about “include “host_runtime.h”” nor how to solve it.

Could anyone give some suggestions?
Thanks a lot :-)

Try to change #include “driver_types.h” to #include <driver_types.h>
in /usr/include/cudnn.h

All these are defined in driver_types.h