转载自http://blog.csdn.net/u010733679/article/details/52221404,经过实际操作,采用了第二种手动替换代码文件、修改个别函数名的方式,成功编译。
---- 原文 -----
faster rcnn 代码默认是使用的cudnn v4, 但是为了体验最新的v5, 或者使用GTX1080 ,我们编译faster rcnn的时候就会报错:
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 src/caffe/data_reader.cpp:6:
/usr/local/cuda/include/cudnn.h:799:27: note: declared here
cudnnStatus_t CUDNNWINAPI cudnnSetPooling2dDescriptor(
为此提供2种解决方案:
(1)取自github @manipopopo
cd caffe-fast-rcnn
Git remote add caffe https://github.com/BVLC/caffe.git
git fetch caffe
git merge caffe/master
Remove self_.attr("phase") = static_cast(this->phase_); from include/caffe/layers/python_layer.hpp after merging.
(2)手动修改文件,参考了卜居大神的博客 http://blog.csdn.net/kkk584520/article/details/51163564
方案1简单方便,但是当我们编译的是其他人修改过得源码,可能就会出错。方案2 步骤如下:
- 用最新caffe源码的以下文件替换掉faster rcnn 的对应文件
include/caffe/layers/cudnn_relu_layer.hpp, src/caffe/layers/cudnn_relu_layer.cpp, src/caffe/layers/cudnn_relu_layer.cu
include/caffe/layers/cudnn_sigmoid_layer.hpp, src/caffe/layers/cudnn_sigmoid_layer.cpp, src/caffe/layers/cudnn_sigmoid_layer.cu
include/caffe/layers/cudnn_tanh_layer.hpp, src/caffe/layers/cudnn_tanh_layer.cpp, src/caffe/layers/cudnn_tanh_layer.cu
- 用caffe源码中的这个文件替换掉faster rcnn 对应文件
include/caffe/util/cudnn.hpp
- 将 faster rcnn 中的 src/caffe/layers/cudnn_conv_layer.cu 文件中的所有
cudnnConvolutionBackwardData_v3 函数名替换为 cudnnConvolutionBackwardData
cudnnConvolutionBackwardFilter_v3函数名替换为 cudnnConvolutionBackwardFilter