美文网首页
Ubuntu 16.04 CUDA8.0 CUDNN6.0 Ca

Ubuntu 16.04 CUDA8.0 CUDNN6.0 Ca

作者: 从菜鸟开始 | 来源:发表于2018-10-27 00:58 被阅读0次

    最近由于遇到开源代码是基于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版本是不同的,所以有些细节问题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
    经历了两天,终于到了最后的一步

    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出现新问题:

    图 4.png

    好吧,放弃py3.6,在anoconda py2.7虚拟环境重新来过:

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

    经过py2.7实验,发现还是卡到上个相同问题,不过原因是不匹配的protobuf版本,我把安装的protobuf3.6.0卸载了:

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

    缺少 caffe_pb.h:
    https://github.com/BVLC/caffe/issues/1761
    兜兜转转,再次用同样办法解决图4的问题

    打算直接注释对应blob.cpp的语句。重新编译,然而:


    图 5

    这个问题一度让我绝望,可是在看了
    https://blog.csdn.net/e01528/article/details/80636867
    后,激发了灵感,这个问题在于:
    ~/Project/sscnet/caffe_code/caffe3d_suncg/build_master_release/python中没有caffe_pb2.py,经过在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

    相关文章

      网友评论

          本文标题:Ubuntu 16.04 CUDA8.0 CUDNN6.0 Ca

          本文链接:https://www.haomeiwen.com/subject/gjiltqtx.html