前言
系列(九)提到的caffe segnet(https://github.com/alexgkendall/caffe-segnet)所基于的cudnn版本很旧,为2.0。但是Alex推荐另外一个开源项目(https://github.com/TimoSaemann/caffe-segnet-cudnn5),它的cudnn版本为5.1。这里就介绍后面这个项目如何在一个较新的ubuntu平台上且cudnn enable情况下编译安装成功。
编译
本人平台及cuda,cudnn版本情况如右所示:ubuntu18.0.4 CUDA9.1 CUDNN7.0.1。
1)enable cudnn
vi Makefile.config and uncomment the below line
USE_CUDNN := 1
2) 然后make clean and make all -j8 这时会遇到下面的编译错误
cudnn.hpp:127:41: error: too few arguments to function ‘cudnnStatus_t cudnnSetPooling2dDescriptor
3)分析,还是cudnn版本不兼容的问题。 毕竟我的版本要比cudnn5.1新不少。 网上有很多说是安装cudnn5.1版本,个人觉得比较麻烦。于是采用下面升级cudnn源代码的办法。 即将另外一个已经在本人平台编译通过caffe里面cudnn代码全部拷到caffe-segnet相对应的目录下。
scp root@192.168.0.xx:/xxx/caffe/include/caffe/util/cudnn.hpp xx/caffe-segnet-cudnn5/include/caffe/util/cudnn.hpp
scp root@192.168.0.xx:/xxx/caffe/src/caffe/util/cudnn.cpp xx/caffe-segnet-cudnn5/src/caffe/util/cudnn.cpp
scp root@192.168.0.xx:/xxx/caffe/src/caffe/layers/cudnn* xx/caffe-segnet-cudnn5/src/caffe/layers/
4)这时 再make clean and make all -j8 以及 make pycaffe -j8就能成功编译通过。 当然如果遇到其它caffe的问题,可以参考上一篇文章(系列九)