由於一些緣由仍是須要使用別人基於Caffe的代碼,可是代碼比較老,默認不支持高版本的cuda或者cudnnbash
怎麼辦呢?基本上就是把最新官方Caffe-BVLC的幾個關鍵文件拿過來替換便可。markdown
腳本以下:app
######################################################################### # File Name: xxx.sh # Author: ChrisZZ # mail: imzhuo AT foxmail.com # Created Time: 2018年05月18日 星期五 16時20分20秒 ######################################################################### #!/bin/bash # 先準備用到的別人的老本的caffe,好比放在了~/work/caffe_xxx cd ~/work MY_CAFFE=~/work/caffe_xxx # 下載官方的最新Caffe git clone https://github.com/BVLC/caffe caffe-BVLC --depth=1 BVLC_CAFFE=~/work/caffe-BVLC # 如今執行以下文件替換。直接執行便可。 cp $BVLC_CAFFE/include/caffe/layers/cudnn_relu_layer.hpp $MY_CAFFE/include/caffe/layers/cudnn_relu_layer.hpp cp $BVLC_CAFFE/include/caffe/layers/cudnn_sigmoid_layer.hpp $MY_CAFFE/include/caffe/layers/cudnn_sigmoid_layer.hpp cp $BVLC_CAFFE/include/caffe/layers/cudnn_tanh_layer.hpp $MY_CAFFE/include/caffe/layers/cudnn_tanh_layer.hpp cp $BVLC_CAFFE/include/caffe/util/cudnn.hpp $MY_CAFFE/include/caffe/util/cudnn.hpp cp $BVLC_CAFFE/src/caffe/layers/cudnn_relu_layer.cpp $MY_CAFFE/src/caffe/layers/cudnn_relu_layer.cpp cp $BVLC_CAFFE/src/caffe/layers/cudnn_relu_layer.cu $MY_CAFFE/src/caffe/layers/cudnn_relu_layer.cu cp $BVLC_CAFFE/src/caffe/layers/cudnn_sigmoid_layer.cpp $MY_CAFFE/src/caffe/layers/cudnn_sigmoid_layer.cpp cp $BVLC_CAFFE/src/caffe/layers/cudnn_sigmoid_layer.cu $MY_CAFFE/src/caffe/layers/cudnn_sigmoid_layer.cu cp $BVLC_CAFFE/src/caffe/layers/cudnn_tanh_layer.cpp $MY_CAFFE/src/caffe/layers/cudnn_tanh_layer.cpp cp $BVLC_CAFFE/src/caffe/layers/cudnn_tanh_layer.cu $MY_CAFFE/src/caffe/layers/cudnn_tanh_layer.cu
而後,再編譯你的caffe_xxx時,CUDA和CuDNN都用起來,均可以編譯了。python2.7