Ubuntu 16.04 CUDA8.0 CUDNN6.0 Caffe-gpu 配置記錄

最近由于遇到開源代碼是基于Caffe的先较,所以打算在ubuntu平臺上配置caffe-gpu,本機硬件:
Ubuntu 16.04
GTX 1070 8g
CUDA 8.0 Cudnn 6
Anaconda Python3.6
Matlab R2017b

Let us go~

相關tips

#查看cudnn版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
or
cat /usr/include/cudnn.h | grep CUDNN_MAJOR -A 2

#查看cuda版本
cat /usr/local/cuda/version.txt
image.png

事實上這和官方的caffe版本是不同的茉贡,所以有些細節(jié)問題bug可能在安裝官方caffe時不會碰到,anyway,舉一反三嘛

一、安裝依賴

For Ubuntu < 17.04:

#General dependencies
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev 
sudo apt-get install git cmake build-essential #以上兩條來自博客来破,是否必須有待確定(https://blog.csdn.net/yhaolpz/article/details/71375762)

BLAS:

sudo apt-get install libatlas-base-dev

二、編譯

2.1 編譯前的操作

主要是一些配置文件的改動:(https://blog.csdn.net/yhaolpz/article/details/71375762

2.2 正式編譯

make all -j8

此步出錯:

CXX src/caffe/util/db_lmdb.cpp
CXX src/caffe/internal_thread.cpp
CXX src/caffe/util/signal_handler.cpp
CXX src/caffe/util/benchmark.cpp
PROTOC src/caffe/proto/caffe.proto
CXX src/caffe/layer_factory.cpp
CXX src/caffe/net.cpp
CXX src/caffe/util/im2col.cpp
CXX src/caffe/util/insert_splits.cpp
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/util/math_functions.hpp:9,
                 from src/caffe/util/im2col.cpp:4:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:23: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:162: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:17: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/util/math_functions.hpp:9,
                 from src/caffe/util/im2col.cpp:4:
/usr/local/cuda/include/cudnn.h:500:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
                           ^
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
                 from ./include/caffe/common.hpp:19,
                 from src/caffe/util/insert_splits.cpp:7:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:23: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:162: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:17: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 src/caffe/util/insert_splits.cpp:7:
/usr/local/cuda/include/cudnn.h:500:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
                           ^
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/util/db.hpp:6,
                 from ./include/caffe/util/db_lmdb.hpp:10,
                 from src/caffe/util/db_lmdb.cpp:2:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:23: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:162: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:17: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/util/db.hpp:6,
                 from ./include/caffe/util/db_lmdb.hpp:10,
                 from src/caffe/util/db_lmdb.cpp:2:
/usr/local/cuda/include/cudnn.h:500:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
                           ^
Makefile:583: recipe for target '/home/dlr/build_master_release/src/caffe/util/im2col.o' failed
make: *** [/home/dlr/build_master_release/src/caffe/util/im2col.o] Error 1
make: *** Waiting for unfinished jobs....
Makefile:583: recipe for target '/home/dlr/build_master_release/src/caffe/util/db_lmdb.o' failed
make: *** [/home/dlr/build_master_release/src/caffe/util/db_lmdb.o] Error 1
Makefile:583: recipe for target '/home/dlr/build_master_release/src/caffe/util/insert_splits.o' failed
make: *** [/home/dlr/build_master_release/src/caffe/util/insert_splits.o] Error 1
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/net.hpp:10,
                 from ./include/caffe/solver.hpp:7,
                 from ./include/caffe/util/signal_handler.h:5,
                 from src/caffe/util/signal_handler.cpp:7:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:23: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:162: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:17: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/net.hpp:10,
                 from ./include/caffe/solver.hpp:7,
                 from ./include/caffe/util/signal_handler.h:5,
                 from src/caffe/util/signal_handler.cpp:7:
/usr/local/cuda/include/cudnn.h:500:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
                           ^
Makefile:583: recipe for target '/home/dlr/build_master_release/src/caffe/util/signal_handler.o' failed
make: *** [/home/dlr/build_master_release/src/caffe/util/signal_handler.o] Error 1
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
                 from ./include/caffe/common.hpp:19,
                 from ./include/caffe/internal_thread.hpp:4,
                 from src/caffe/internal_thread.cpp:4:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:23: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:162: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:17: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/internal_thread.hpp:4,
                 from src/caffe/internal_thread.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/dlr/build_master_release/src/caffe/internal_thread.o' failed
make: *** [/home/dlr/build_master_release/src/caffe/internal_thread.o] Error 1
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
                 from ./include/caffe/common.hpp:19,
                 from src/caffe/util/benchmark.cpp:3:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:23: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:162: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:17: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 src/caffe/util/benchmark.cpp:3:
/usr/local/cuda/include/cudnn.h:500:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
                           ^
Makefile:583: recipe for target '/home/dlr/build_master_release/src/caffe/util/benchmark.o' failed
make: *** [/home/dlr/build_master_release/src/caffe/util/benchmark.o] Error 1
In file included from ./include/caffe/util/device_alternate.hpp:40:0,
                 from ./include/caffe/common.hpp:19,
                 from src/caffe/net.cpp:10:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:23: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:162: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:17: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 src/caffe/net.cpp:10:
/usr/local/cuda/include/cudnn.h:500:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
                           ^
Makefile:583: recipe for target '/home/dlr/build_master_release/src/caffe/net.o' failed
make: *** [/home/dlr/build_master_release/src/caffe/net.o] Error 1
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/layer.hpp:8,
                 from src/caffe/layer_factory.cpp:8:
./include/caffe/util/cudnn.hpp: In function ‘const char* cudnnGetErrorString(cudnnStatus_t)’:
./include/caffe/util/cudnn.hpp:23: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:162: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:17: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/layer.hpp:8,
                 from src/caffe/layer_factory.cpp:8:
/usr/local/cuda/include/cudnn.h:500:27: note: declared here
 cudnnStatus_t CUDNNWINAPI cudnnSetConvolution2dDescriptor( cudnnConvolutionDescriptor_t convDesc,
                           ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetTanHLayer(const caffe::LayerParameter&) [with Dtype = double]’:
src/caffe/layer_factory.cpp:239:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetTanHLayer(const caffe::LayerParameter&) [with Dtype = float]’:
src/caffe/layer_factory.cpp:239:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetSoftmaxLayer(const caffe::LayerParameter&) [with Dtype = double]’:
src/caffe/layer_factory.cpp:216:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetSoftmaxLayer(const caffe::LayerParameter&) [with Dtype = float]’:
src/caffe/layer_factory.cpp:216:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetSigmoidLayer(const caffe::LayerParameter&) [with Dtype = double]’:
src/caffe/layer_factory.cpp:193:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetSigmoidLayer(const caffe::LayerParameter&) [with Dtype = float]’:
src/caffe/layer_factory.cpp:193:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetReLULayer(const caffe::LayerParameter&) [with Dtype = double]’:
src/caffe/layer_factory.cpp:170:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetReLULayer(const caffe::LayerParameter&) [with Dtype = float]’:
src/caffe/layer_factory.cpp:170:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetLRNLayer(const caffe::LayerParameter&) [with Dtype = double]’:
src/caffe/layer_factory.cpp:147:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetLRNLayer(const caffe::LayerParameter&) [with Dtype = float]’:
src/caffe/layer_factory.cpp:147:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetPoolingLayer(const caffe::LayerParameter&) [with Dtype = double]’:
src/caffe/layer_factory.cpp:110:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetPoolingLayer(const caffe::LayerParameter&) [with Dtype = float]’:
src/caffe/layer_factory.cpp:110:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetConvolutionLayer(const caffe::LayerParameter&) [with Dtype = double]’:
src/caffe/layer_factory.cpp:71:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptr<caffe::Layer<Dtype> > caffe::GetConvolutionLayer(const caffe::LayerParameter&) [with Dtype = float]’:
src/caffe/layer_factory.cpp:71:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
Makefile:583: recipe for target '/home/dlr/build_master_release/src/caffe/layer_factory.o' failed
make: *** [/home/dlr/build_master_release/src/caffe/layer_factory.o] Error 1

在github上找到解決放方法:

https://github.com/BVLC/caffe/issues/5793#issuecomment-404729152

翻過了第一個bug忘古,下面有出錯了:

CXX src/caffe/internal_thread.cpp
CXX src/caffe/util/im2col.cpp
CXX src/caffe/net.cpp
PROTOC src/caffe/proto/caffe.proto
CXX src/caffe/util/db_lmdb.cpp
CXX src/caffe/layer_factory.cpp
CXX src/caffe/util/benchmark.cpp
CXX src/caffe/util/signal_handler.cpp
CXX src/caffe/util/insert_splits.cpp
CXX src/caffe/util/db_leveldb.cpp
CXX src/caffe/util/cudnn.cpp
CXX src/caffe/util/blocking_queue.cpp
CXX src/caffe/util/db.cpp
CXX src/caffe/util/math_functions.cpp
CXX src/caffe/util/io.cpp
CXX src/caffe/util/upgrade_proto.cpp
CXX src/caffe/util/hdf5.cpp
CXX src/caffe/layers/prelu_layer.cpp
CXX src/caffe/layers/lrn_layer.cpp
CXX src/caffe/layers/eltwise_layer.cpp
CXX src/caffe/layers/softmax_layer.cpp
CXX src/caffe/layers/batch_reindex_layer.cpp
CXX src/caffe/layers/neuron_layer.cpp
CXX src/caffe/layers/image_data_layer.cpp
CXX src/caffe/layers/concat_layer.cpp
CXX src/caffe/layers/bnll_layer.cpp
CXX src/caffe/layers/cudnn_softmax_layer.cpp
CXX src/caffe/layers/power_layer.cpp
CXX src/caffe/layers/hinge_loss_layer.cpp
CXX src/caffe/layers/euclidean_loss_layer.cpp
CXX src/caffe/layers/slice_layer.cpp
CXX src/caffe/layers/cudnn_relu_layer.cpp
CXX src/caffe/layers/tile_layer.cpp
CXX src/caffe/layers/base_data_layer.cpp
CXX src/caffe/layers/hdf5_data_layer.cpp
src/caffe/layers/cudnn_relu_layer.cpp: In member function ‘virtual void caffe::CuDNNReLULayer<Dtype>::LayerSetUp(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&)’:
src/caffe/layers/cudnn_relu_layer.cpp:14:3: error: ‘createTensorDesc’ is not a member of ‘caffe::cudnn’
   cudnn::createTensorDesc<Dtype>(&bottom_desc_);
   ^
src/caffe/layers/cudnn_relu_layer.cpp:14:32: error: expected primary-expression before ‘>’ token
   cudnn::createTensorDesc<Dtype>(&bottom_desc_);
                                ^
src/caffe/layers/cudnn_relu_layer.cpp:15:3: error: ‘createTensorDesc’ is not a member of ‘caffe::cudnn’
   cudnn::createTensorDesc<Dtype>(&top_desc_);
   ^
src/caffe/layers/cudnn_relu_layer.cpp:15:32: error: expected primary-expression before ‘>’ token
   cudnn::createTensorDesc<Dtype>(&top_desc_);
                                ^
src/caffe/layers/cudnn_relu_layer.cpp: In member function ‘virtual void caffe::CuDNNReLULayer<Dtype>::Reshape(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&)’:
src/caffe/layers/cudnn_relu_layer.cpp:24:3: error: ‘setTensorNdDesc’ is not a member of ‘caffe::cudnn’
   cudnn::setTensorNdDesc<Dtype>(&bottom_desc_, bottom[0]->shape());
   ^
src/caffe/layers/cudnn_relu_layer.cpp:24:31: error: expected primary-expression before ‘>’ token
   cudnn::setTensorNdDesc<Dtype>(&bottom_desc_, bottom[0]->shape());
                               ^
src/caffe/layers/cudnn_relu_layer.cpp:25:3: error: ‘setTensorNdDesc’ is not a member of ‘caffe::cudnn’
   cudnn::setTensorNdDesc<Dtype>(&top_desc_, bottom[0]->shape());
   ^
src/caffe/layers/cudnn_relu_layer.cpp:25:31: error: expected primary-expression before ‘>’ token
   cudnn::setTensorNdDesc<Dtype>(&top_desc_, bottom[0]->shape());
                               ^
src/caffe/layers/cudnn_relu_layer.cpp: In instantiation of ‘void caffe::CuDNNReLULayer<Dtype>::Reshape(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = float]’:
src/caffe/layers/cudnn_relu_layer.cpp:38:1:   required from here
src/caffe/layers/cudnn_relu_layer.cpp:24:46: warning: left operand of comma operator has no effect [-Wunused-value]
   cudnn::setTensorNdDesc<Dtype>(&bottom_desc_, bottom[0]->shape());
                                              ^
src/caffe/layers/cudnn_relu_layer.cpp:25:43: warning: left operand of comma operator has no effect [-Wunused-value]
   cudnn::setTensorNdDesc<Dtype>(&top_desc_, bottom[0]->shape());
                                           ^
src/caffe/layers/cudnn_relu_layer.cpp: In instantiation of ‘void caffe::CuDNNReLULayer<Dtype>::Reshape(const std::vector<caffe::Blob<Dtype>*>&, const std::vector<caffe::Blob<Dtype>*>&) [with Dtype = double]’:
src/caffe/layers/cudnn_relu_layer.cpp:38:1:   required from here
src/caffe/layers/cudnn_relu_layer.cpp:24:46: warning: left operand of comma operator has no effect [-Wunused-value]
   cudnn::setTensorNdDesc<Dtype>(&bottom_desc_, bottom[0]->shape());
                                              ^
src/caffe/layers/cudnn_relu_layer.cpp:25:43: warning: left operand of comma operator has no effect [-Wunused-value]
   cudnn::setTensorNdDesc<Dtype>(&top_desc_, bottom[0]->shape());
                                           ^
Makefile:583: recipe for target '/home/dlr/Project/sscnet/caffe_code/caffe3d_suncg/build_master_release/src/caffe/layers/cudnn_relu_layer.o' failed
make: *** [/home/dlr/Project/sscnet/caffe_code/caffe3d_suncg/build_master_release/src/caffe/layers/cudnn_relu_layer.o] Error 1
make: *** Waiting for unfinished jobs....

https://blog.csdn.net/qq_15505637/article/details/78423233

https://github.com/BVLC/caffe/issues/6139#issuecomment-407317661

注意的是SSCNet作者提到caffe
經(jīng)歷了兩天徘禁,終于到了最后的一步

https://github.com/muupan/dqn-in-the-caffe/issues/3#issuecomment-70795202

編譯時 避免多版本protobuf 沖突;

conda uninstall protobuf
conda uninstall libprotobuf

但注意在pycaffe編譯成功后再裝回來髓堪,否則import caffe會報錯找不到google.protobuf

conda install libprotobuf

https://github.com/BVLC/caffe/issues/3046#issuecomment-316606472
(可能我這樣有些暴力送朱。。)

接著可以開始運行demo了:

python demotest_model.py

然而又有新bug:


圖 1.png
E1031 20:10:34.877794 22173 common.cpp:113] Cannot create Cublas handle. Cublas won't be available.
F1031 20:10:35.117483 22163 cudnn_conv_layer.cpp:53] Check failed: status == CUDNN_STATUS_SUCCESS (4 vs. 0)  CUDNN_STATUS_INTERNAL_ERROR
*** Check failure stack trace: ***
Aborted (core dumped)
解決方法 注釋掉 Cudnn模式干旁,從新編譯驶沼。。(雖然不治本吧)

解決了:https://devtalk.nvidia.com/default/topic/1007071/cuda-setup-and-installation/cuda-error-when-running-matrixmulcublas-sample-ubuntu-16-04/

sudo rm -rf .nv/

運行demo時争群,遇到問題

圖 2.png

參考:https://github.com/shurans/sscnet/issues/28#issue-278987264 (也是暴力的方法)
然后重新編譯

但是遇到了之前解決好的問題:


圖 3.png

而且之前的解決方法無效了回怜??

export LD_LIBRARY_PATH=/home/dlr/Project/sscnet/caffe_code/caffe3d_suncg/build_master_release/lib:/home/dlr/Downloads/cuda8_5.1/lib64:~/anaconda3/lib:$LD_LIBRARY_PATH
export PYTHONPATH=/home/dlr/Project/sscnet/caffe_code/caffe3d_suncg/build_master_release/python:$PYTHONPATH

參考https://github.com/BVLC/caffe/issues/5170#issuecomment-271965791
對于python3换薄,編譯caffe時要選擇對應版本的protobuf玉雾,于是安裝protobuf-3.6.0
參考:http://blog.const.net.cn/a/19247.htm
https://github.com/protocolbuffers/protobuf/releases
重新編譯,編譯通過轻要,但在make pycaffe出現(xiàn)新問題:

圖 4.png

好吧复旬,放棄py3.6,在anoconda py2.7虛擬環(huán)境重新來過:

git clone https://github.com/shurans/sscnet

經(jīng)過py2.7實驗伦腐,發(fā)現(xiàn)還是卡到上個相同問題赢底,不過原因是不匹配的protobuf版本,我把安裝的protobuf3.6.0卸載了:

#在protobuf下載的包的位置
make clean
make uninstall

缺少 caffe_pb.h:
https://github.com/BVLC/caffe/issues/1761
兜兜轉(zhuǎn)轉(zhuǎn)柏蘑,再次用同樣辦法解決圖4的問題

打算直接注釋對應blob.cpp的語句幸冻。重新編譯,然而:


圖 5

這個問題一度讓我絕望咳焚,可是在看了
https://blog.csdn.net/e01528/article/details/80636867
后洽损,激發(fā)了靈感,這個問題在于:
~/Project/sscnet/caffe_code/caffe3d_suncg/build_master_release/python中沒有caffe_pb2.py,經(jīng)過在caffe3d_suncg下搜索革半,位于
~/Project/sscnet/caffe_code/caffe3d_suncg/python/caffe/proto/caffe_pb2.py
應該要保證~/Project/sscnet/caffe_code/caffe3d_suncg/build_master_release/python/caffe/proto/下有caffe_pb2.py碑定,只要從上面的位置復制過來就成功了
還有注意

conda install protobuf==2.6.1

終于import caffe 成功流码!


圖 6
最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市延刘,隨后出現(xiàn)的幾起案子漫试,更是在濱河造成了極大的恐慌,老刑警劉巖碘赖,帶你破解...
    沈念sama閱讀 212,949評論 6 492
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件驾荣,死亡現(xiàn)場離奇詭異,居然都是意外死亡普泡,警方通過查閱死者的電腦和手機播掷,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,772評論 3 385
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來撼班,“玉大人歧匈,你說我怎么就攤上這事∨猷遥” “怎么了件炉?”我有些...
    開封第一講書人閱讀 158,419評論 0 348
  • 文/不壞的土叔 我叫張陵,是天一觀的道長矮湘。 經(jīng)常有香客問我妻率,道長,這世上最難降的妖魔是什么板祝? 我笑而不...
    開封第一講書人閱讀 56,812評論 1 285
  • 正文 為了忘掉前任,我火速辦了婚禮走净,結(jié)果婚禮上券时,老公的妹妹穿的比我還像新娘。我一直安慰自己伏伯,他們只是感情好橘洞,可當我...
    茶點故事閱讀 65,927評論 6 386
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著说搅,像睡著了一般炸枣。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上弄唧,一...
    開封第一講書人閱讀 50,102評論 1 291
  • 那天适肠,我揣著相機與錄音,去河邊找鬼候引。 笑死侯养,一個胖子當著我的面吹牛,可吹牛的內(nèi)容都是我干的澄干。 我是一名探鬼主播逛揩,決...
    沈念sama閱讀 39,171評論 3 411
  • 文/蒼蘭香墨 我猛地睜開眼柠傍,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了辩稽?” 一聲冷哼從身側(cè)響起惧笛,我...
    開封第一講書人閱讀 37,921評論 0 268
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎逞泄,沒想到半個月后患整,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,366評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡炭懊,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 36,675評論 2 327
  • 正文 我和宋清朗相戀三年并级,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片侮腹。...
    茶點故事閱讀 38,820評論 1 341
  • 序言:一個原本活蹦亂跳的男人離奇死亡嘲碧,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出父阻,到底是詐尸還是另有隱情愈涩,我是刑警寧澤,帶...
    沈念sama閱讀 34,523評論 4 335
  • 正文 年R本政府宣布加矛,位于F島的核電站履婉,受9級特大地震影響,放射性物質(zhì)發(fā)生泄漏斟览。R本人自食惡果不足惜毁腿,卻給世界環(huán)境...
    茶點故事閱讀 40,162評論 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望苛茂。 院中可真熱鬧已烤,春花似錦、人聲如沸妓羊。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,885評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽躁绸。三九已至裕循,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間净刮,已是汗流浹背剥哑。 一陣腳步聲響...
    開封第一講書人閱讀 32,126評論 1 267
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留庭瑰,地道東北人星持。 一個月前我還...
    沈念sama閱讀 46,647評論 2 362
  • 正文 我出身青樓,卻偏偏與公主長得像弹灭,于是被迫代替她去往敵國和親督暂。 傳聞我的和親對象是個殘疾皇子揪垄,可洞房花燭夜當晚...
    茶點故事閱讀 43,732評論 2 351

推薦閱讀更多精彩內(nèi)容