Caffe: Caffe installation error with CUDNN V6.0

Created on 22 Jul 2017  Â·  21Comments  Â·  Source: BVLC/caffe

CXX src/caffe/data_transformer.cpp
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/blob.hpp:8,
                 from ./include/caffe/data_transformer.hpp:6,
                 from src/caffe/data_transformer.cpp:8:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:21:10: warning: enumeration value ‘CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING’ not handled in switch [-Wswitch]
   switch (status) {
          ^
./include/caffe/util/cudnn.hpp: In function ‘void caffe::cudnn::setConvolutionDesc(cudnnConvolutionStruct**, cudnnTensorDescriptor_t, cudnnFilterDescriptor_t, int, int, int, int)’:
./include/caffe/util/cudnn.hpp:113:70: error: too few arguments to function ‘cudnnStatus_t cudnnSetConvolution2dDescriptor(cudnnConvolutionDescriptor_t, int, int, int, int, int, int, cudnnConvolutionMode_t, cudnnDataType_t)’
       pad_h, pad_w, stride_h, stride_w, 1, 1, CUDNN_CROSS_CORRELATION));
                                                                      ^
./include/caffe/util/cudnn.hpp:15:28: note: in definition of macro ‘CUDNN_CHECK’
     cudnnStatus_t status = condition; \
                            ^
In file included from ./include/caffe/util/cudnn.hpp:5:0,
                 from ./include/caffe/util/device_alternate.hpp:40,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/blob.hpp:8,
                 from ./include/caffe/data_transformer.hpp:6,
                 from src/caffe/data_transformer.cpp:8:
/usr/local/cuda-8.0/include/cudnn.h:500:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
                           ^
Makefile:585: recipe for target '.build_release/src/caffe/data_transformer.o' failed
make: *** [.build_release/src/caffe/data_transformer.o] Error 1

Kindy help me if anyone has any solution !

Most helpful comment

Faced the same problem. It's happening due to cudnn.hpp (Location: include/caffe/util/cudnn.hpp) . Update cudnn.hpp file. It is not considering the current cuDNN versions.

Update the cudnn.hpp from github repo, BVLC/caffe/include/caffe/util/cudnn.hpp
Or, go to this link https://github.com/BVLC/caffe/blob/master/include/caffe/util/cudnn.hpp [Copy this and replace the old one]

All 21 comments

Which version of caffeare you using?

I have the same problem.. Do you solved it?

Same problem using cuDNN v7.0 (August 3, 2017) for CUDA 8.0 on Ubuntu16.04

Anyone found a solution?

You can use other caffe cudnn.hpp to replace current one.
Using:
cp /export/anshan/caffe/caffe-master/include/caffe/util/cudnn.hpp ./include/caffe/util/

i meet the similar problem:

scopeserver@scopephotos:~/RaidDisk/DeepLearning/mwang/models/appearance-flow/caffe$ make all
CXX src/caffe/layers/softmax_layer.cpp
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/blob.hpp:8,
                 from ./include/caffe/layers/softmax_layer.hpp:6,
                 from src/caffe/layers/softmax_layer.cpp:4:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:21:10: warning: enumeration value ‘CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING’ not handled in switch [-Wswitch]
   switch (status) {
          ^
./include/caffe/util/cudnn.hpp: In function ‘void caffe::cudnn::setConvolutionDesc(cudnnConvolutionStruct**, cudnnTensorDescriptor_t, cudnnFilterDescriptor_t, int, int, int, int)’:
./include/caffe/util/cudnn.hpp:113:70: error: too few arguments to function ‘cudnnStatus_t cudnnSetConvolution2dDescriptor(cudnnConvolutionDescriptor_t, int, int, int, int, int, int, cudnnConvolutionMode_t, cudnnDataType_t)’
       pad_h, pad_w, stride_h, stride_w, 1, 1, CUDNN_CROSS_CORRELATION));
                                                                      ^
./include/caffe/util/cudnn.hpp:15:28: note: in definition of macro ‘CUDNN_CHECK’
     cudnnStatus_t status = condition; \
                            ^
In file included from ./include/caffe/util/cudnn.hpp:5:0,
                 from ./include/caffe/util/device_alternate.hpp:40,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/blob.hpp:8,
                 from ./include/caffe/layers/softmax_layer.hpp:6,
                 from src/caffe/layers/softmax_layer.cpp:4:
/usr/local/cuda/include/cudnn.h:500:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
                           ^
Makefile:583: recipe for target '/home/scopeserver/RaidDisk/DeepLearning/mwang/models/appearance-flow/caffe/.build_release/src/caffe/layers/softmax_layer.o' failed
make: *** [/home/scopeserver/RaidDisk/DeepLearning/mwang/models/appearance-flow/caffe/.build_release/src/caffe/layers/softmax_layer.o] Error 1

cuDNN 7.0 build fail.

I'm having the same problem with Ubuntu 16.04.3 LTS with CUDA 8.0 and CUDNN 7.0.2.38-1

$ make all
CXX src/caffe/util/cudnn.cpp
In file included from /usr/local/cuda/include/channel_descriptor.h:62:0,
                 from /usr/local/cuda/include/cuda_runtime.h:90,
                 from /usr/include/cudnn.h:64,
                 from ./include/caffe/util/cudnn.hpp:5,
                 from src/caffe/util/cudnn.cpp:2:
/usr/local/cuda/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/include/channel_descriptor.h:62:0,
                 from /usr/local/cuda/include/cuda_runtime.h:90,
                 from /usr/include/cudnn.h:64,
                 from ./include/caffe/util/cudnn.hpp:5,
                 from src/caffe/util/cudnn.cpp:2:
/usr/local/cuda/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/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/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 src/caffe/util/cudnn.cpp:2:0:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:21:10: warning: enumeration value ‘CUDNN_STATUS_RUNTIME_IN_PROGRESS’ not handled in switch [-Wswitch]
   switch (status) {
          ^
./include/caffe/util/cudnn.hpp:21:10: warning: enumeration value ‘CUDNN_STATUS_RUNTIME_FP_OVERFLOW’ not handled in switch [-Wswitch]
Makefile:581: recipe for target '.build_release/src/caffe/util/cudnn.o' failed
make: *** [.build_release/src/caffe/util/cudnn.o] Error 1

I could solve the error by downloading the correct version of CUDNN.
for me it was v5.1 . You can try older version of CUDNN if the prblem persists. But from the error i could say your CUDNN version should be < 6.0

For fixing the error "too few arguments" edit the cudnn.hpp file to add a suffix "_v4" for the cribbing function. i.e example replace function "cudnnSetConvolution2dDescriptor" with "cudnnSetConvolution2dDescriptor_v4".

Caffes requires cudnn v5. Cudnn v6 retains the functionality of v5 by maintaining separate function which goes by the same name except that is has a prefix. Make sure to use corrrect prefix by reading the well documented cudnn.hpp file

check your Make.config
if you use CUDA_DIR := /usr/local/cuda-8.0
then
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \
-gencode arch=compute_60,code=sm_60 \
-gencode arch=compute_61,code=sm_61 \

if you use CUDA_DIR := /usr/local/cuda-7.5
then
CUDA_ARCH := -gencode arch=compute_20,code=sm_20 \
-gencode arch=compute_20,code=sm_21 \
-gencode arch=compute_30,code=sm_30 \
-gencode arch=compute_35,code=sm_35 \
-gencode arch=compute_50,code=sm_50 \
-gencode arch=compute_52,code=sm_52 \

Please always check your CUDA version and make sure you download the matching version of cuDNN. The above answers seem to provide sufficient help, so I'm closing this issue. Feel free to reopen if the problem reoccurs though.

does the same problem persists in the latest caffe as well ? Is it tested with latest cuDNN and CUDA ?

I'm using cuda-9.1 and i get the same errors when running make all

Following this guide

Edit:
As the guide suggested, i installed caffe-rc5 which turns out was the issue.
I cloned the latest repo of caffe and the issue went away.

It seems additional parameter is added to cudnnSetConvolution2dDescriptor.
I edited like this
cudnnSetConvolution2dDescriptor(*conv,
pad_h, pad_w, stride_h, stride_w, 1, 1, CUDNN_CROSS_CORRELATION, CUDNN_DATA_FLOAT))
and it compiled well.
(https://devtalk.nvidia.com/default/topic/1002826/gpu-accelerated-libraries/question-about-cudnnsetconvolution2ddescriptor/)

Faced the same problem. It's happening due to cudnn.hpp (Location: include/caffe/util/cudnn.hpp) . Update cudnn.hpp file. It is not considering the current cuDNN versions.

Update the cudnn.hpp from github repo, BVLC/caffe/include/caffe/util/cudnn.hpp
Or, go to this link https://github.com/BVLC/caffe/blob/master/include/caffe/util/cudnn.hpp [Copy this and replace the old one]

@mdamirsohail13 solved my problem

@mdamirsohail13 solved my problem,too,thank you!

Faced the same problem. It's happening due to cudnn.hpp (Location: include/caffe/util/cudnn.hpp) . Update cudnn.hpp file. It is not considering the current cuDNN versions.

Update the cudnn.hpp from github repo, BVLC/caffe/include/caffe/util/cudnn.hpp
Or, go to this link https://github.com/BVLC/caffe/blob/master/include/caffe/util/cudnn.hpp [Copy this and replace the old one]

It works, you are my hero!!! Thank you!

Faced the same problem. It's happening due to cudnn.hpp (Location: include/caffe/util/cudnn.hpp) . Update cudnn.hpp file. It is not considering the current cuDNN versions.

Update the cudnn.hpp from github repo, BVLC/caffe/include/caffe/util/cudnn.hpp
Or, go to this link https://github.com/BVLC/caffe/blob/master/include/caffe/util/cudnn.hpp [Copy this and replace the old one]

works for me

You can use other caffe cudnn.hpp to replace current one.
Using:
cp /export/anshan/caffe/caffe-master/include/caffe/util/cudnn.hpp ./include/caffe/util/

God bless your soul, stranger

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kelvinxu picture kelvinxu  Â·  3Comments

serimp picture serimp  Â·  3Comments

OpenHero picture OpenHero  Â·  3Comments

iamhankai picture iamhankai  Â·  3Comments

prathmeshrmadhu picture prathmeshrmadhu  Â·  3Comments