warning: enumeration value ‘CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING’ not handled in switch

warning: enumeration value ‘CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSI not handled in switch

如果安装的cudnn比较新,则深度学习中算法自带的caffe无法编译通过,报错显示如下:
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:18:10: warning: enumeration value ‘CUDNN_STATUS_RUNTIME_PREREQUISITE_MISSING’ not handled in switch [
-Wswitch]
switch (status) {
^
./include/caffe/util/cudnn.hpp:18:10: warning: enumeration value ‘CUDNN_STATUS_RUNTIME_IN_PROGRESS’ not handled in switch [-Wswitch]
./include/caffe/util/cudnn.hpp:18:10: warning: enumeration value ‘CUDNN_STATUS_RUNTIME_FP_OVERFLOW’ not handled in switch [-Wswitch]
./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:105:70: error: too few arguments to function ‘cudnnStatus_t cudnnSetConvolution2dDescriptor(cudnnConv
olutionDescriptor_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:12:28: note: in definition of macro ‘CUDNN_CHECK’
cudnnStatus_t status = condition;
^
In file included from ./include/caffe/util/cudnn.hpp:5:0,
from src/caffe/util/cudnn.cpp:2:
/usr/include/cudnn.h:537:27: note: declared here
cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
^

解决方法

下载最新版本的caffe,将你的算法中的里的几个文件替换成最新版caffe对应的include和src文件夹里面的:

你的算法原路径/include/caffe/util/cudnn.hpp

你的算法原路径/include/caffe/layers/下面cudnn_开头的所有文件

你的算法原路径/src/caffe/util/cudnn.cpp

你的算法原路径/src/caffe/layers/ 下面cudnn_开头的所有文件

最新版caffe下载链接:https://github.com/BVLC/caffe(ubuntu下面可用git clone+网址直接下载至当前目录)

提示:要将旧代码从文件夹里面移除,不能只改名字做备份,否则依旧有错误提示

你可能感兴趣的:(深度学习,linux)