【问题标题】:Issues with compiling Caffe with cuDNN使用 cuDNN 编译 Caffe 的问题
【发布时间】:2015-03-15 06:40:32
【问题描述】:

我正在尝试使用 750ti geforce gpu 在 ubuntu14 上编译 caffe,但我不能。我在 /usr/local/cuda/lib64 中安装了 cudnn 库,在 /usr/local/cuda/include 中安装了 cudnn.h 头文件似乎仍然存在问题。我真的认为在 Makefile.config 中启用 cudNN=1

# cuDNN acceleration switch (uncomment to build with cuDNN).
USE_CUDNN := 1

这就是问题所在。这些错误究竟是什么?

./include/caffe/util/cudnn.hpp:65:5: error: expected primary-expression before ‘int’
     int n, int c, int h, int w,
     ^
./include/caffe/util/cudnn.hpp:65:12: error: expected primary-expression before ‘int’
     int n, int c, int h, int w,
            ^
./include/caffe/util/cudnn.hpp:65:19: error: expected primary-expression before ‘int’
     int n, int c, int h, int w,
                   ^
./include/caffe/util/cudnn.hpp:65:26: error: expected primary-expression before ‘int’
     int n, int c, int h, int w,
                          ^
./include/caffe/util/cudnn.hpp:66:5: error: expected primary-expression before ‘int’
     int stride_n, int stride_c, int stride_h, int stride_w) {
     ^
./include/caffe/util/cudnn.hpp:66:19: error: expected primary-expression before ‘int’
     int stride_n, int stride_c, int stride_h, int stride_w) {
                   ^
./include/caffe/util/cudnn.hpp:66:33: error: expected primary-expression before ‘int’
     int stride_n, int stride_c, int stride_h, int stride_w) {
                                 ^
./include/caffe/util/cudnn.hpp:66:47: error: expected primary-expression before ‘int’
     int stride_n, int stride_c, int stride_h, int stride_w) {
                                               ^
./include/caffe/util/cudnn.hpp:72:29: error: variable or field ‘setTensor4dDesc’ declared void
 inline void setTensor4dDesc(cudnnTensor4dDescriptor_t* desc,
                             ^
./include/caffe/util/cudnn.hpp:72:29: error: ‘cudnnTensor4dDescriptor_t’ was not declared in this scope
./include/caffe/util/cudnn.hpp:72:56: error: ‘desc’ was not declared in this scope
 inline void setTensor4dDesc(cudnnTensor4dDescriptor_t* desc,
                                                        ^
./include/caffe/util/cudnn.hpp:73:5: error: expected primary-expression before ‘int’
     int n, int c, int h, int w) {
     ^
./include/caffe/util/cudnn.hpp:73:12: error: expected primary-expression before ‘int’
     int n, int c, int h, int w) {
            ^
./include/caffe/util/cudnn.hpp:73:19: error: expected primary-expression before ‘int’
     int n, int c, int h, int w) {
                   ^
./include/caffe/util/cudnn.hpp:73:26: error: expected primary-expression before ‘int’
     int n, int c, int h, int w) {
                          ^
./include/caffe/util/cudnn.hpp:97:5: error: ‘cudnnTensor4dDescriptor_t’ has not been declared
     cudnnTensor4dDescriptor_t bottom, cudnnFilterDescriptor_t filter,
     ^
./include/caffe/util/cudnn.hpp: In function ‘void caffe::cudnn::setConvolutionDesc(cudnnConvolutionStruct**, int, cudnnFilterDescriptor_t, int, int, int, int)’:
./include/caffe/util/cudnn.hpp:100:70: error: there are no arguments to ‘cudnnSetConvolutionDescriptor’ that depend on a template parameter, so a declaration of ‘cudnnSetConvolutionDescriptor’ must be available [-fpermissive]
       pad_h, pad_w, stride_h, stride_w, 1, 1, CUDNN_CROSS_CORRELATION));
                                                                      ^
./include/caffe/util/cudnn.hpp:11:28: note: in definition of macro ‘CUDNN_CHECK’
     cudnnStatus_t status = condition; \
                            ^
./include/caffe/util/cudnn.hpp:100:70: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
       pad_h, pad_w, stride_h, stride_w, 1, 1, CUDNN_CROSS_CORRELATION));
                                                                      ^
./include/caffe/util/cudnn.hpp:11:28: note: in definition of macro ‘CUDNN_CHECK’
     cudnnStatus_t status = condition; \
                            ^
./include/caffe/util/cudnn.hpp: In function ‘void caffe::cudnn::createPoolingDesc(cudnnPoolingStruct**, caffe::PoolingParameter_PoolMethod, cudnnPoolingMode_t*, int, int, int, int)’:
./include/caffe/util/cudnn.hpp:119:27: error: there are no arguments to ‘cudnnSetPoolingDescriptor’ that depend on a template parameter, so a declaration of ‘cudnnSetPoolingDescriptor’ must be available [-fpermissive]
         stride_h, stride_w));
                           ^
./include/caffe/util/cudnn.hpp:11:28: note: in definition of macro ‘CUDNN_CHECK’
     cudnnStatus_t status = condition; \
                            ^
make: *** [.build_release/src/caffe/syncedmem.o] Error 1

我测试了 CUDA 示例,GPU 在 cuda 上运行良好。结果如下……

root@pbu-OptiPlex-740-Enhanced:/home/pbu/NVIDIA_CUDA-6.5_Samples/0_Simple/matrixMul# ./matrixMul
[Matrix Multiply Using CUDA] - Starting...
GPU Device 0: "GeForce GTX 750 Ti" with compute capability 5.0

MatrixA(320,320), MatrixB(640,320)
Computing result using CUDA Kernel...
done
Performance= 157.82 GFlop/s, Time= 0.831 msec, Size= 131072000 Ops, WorkgroupSize= 1024 threads/block
Checking computed result for correctness: Result = PASS

Note: For peak performance, please refer to the matrixMulCUBLAS example.

【问题讨论】:

    标签: cuda caffe


    【解决方案1】:

    可从S. Layton's github page 获得适用于 cuDNNv2 的 Caffe 版本。

    他的 Caffe 主分支使用 cuDNNv2。您可以从 github 页面下载。

    他向官方 Caffe github 提出了拉取请求,如果您想了解详细信息,请访问here 获取完整讨论。

    【讨论】:

    • 请不要只添加链接,如果您想提供一个好的答案,您需要给出一个完整的建议,这些链接仅用于深度信息目的。否则你可以发表评论
    • 我编辑了我的答案,但除了从链接下载并使用相应的版本之外,没有什么可说的了……如果有其他问题,我很乐意回答……
    • 现在很完美 :) 但仅供参考,OP 已经回答了他的问题 ;)
    • 我认为知道有一个适用于 v2 的版本很有用。
    • 是的,我同意你的看法
    【解决方案2】:

    我下载了 cuDNN R1,现在它可以工作了。看起来 cudNN R2 最新的一个与 caffe 不兼容。

    【讨论】:

      猜你喜欢
      • 2015-07-19
      • 1970-01-01
      • 1970-01-01
      • 2017-03-17
      • 1970-01-01
      • 1970-01-01
      • 2016-10-06
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多