5

我正在尝试使用 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.
4

2 回答 2

3

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

于 2015-01-16T16:21:34.000 回答
3

可从S. Layton 的 github 页面获得与 cuDNNv2 配合使用的 Caffe 版本。

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

他向官方 Caffe github 提出了拉取请求,如果您想了解详细信息,可以在此处获得完整的讨论。

于 2015-02-10T01:27:00.183 回答