I have successfully installed caffe with CUDA 6.5. But when I install it with cuDNN 6.5 v2 after uncommenting USE_CUDNN:=1, make all command gives the followin error.
In file included from ./include/caffe/loss_layers.hpp:11:0,
from ./include/caffe/common_layers.hpp:12,
from ./include/caffe/vision_layers.hpp:10,
from src/caffe/layer_factory.cpp:6:
./include/caffe/neuron_layers.hpp:434:3: error: ‘cudnnHandle_t’ does not name a type
cudnnHandle_t handle_;
^
./include/caffe/neuron_layers.hpp:435:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t bottom_desc_;
^
./include/caffe/neuron_layers.hpp:436:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t top_desc_;
^
./include/caffe/neuron_layers.hpp:517:3: error: ‘cudnnHandle_t’ does not name a type
cudnnHandle_t handle_;
^
./include/caffe/neuron_layers.hpp:518:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t bottom_desc_;
^
./include/caffe/neuron_layers.hpp:519:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t top_desc_;
^
./include/caffe/neuron_layers.hpp:602:3: error: ‘cudnnHandle_t’ does not name a type
cudnnHandle_t handle_;
^
./include/caffe/neuron_layers.hpp:603:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t bottom_desc_;
^
./include/caffe/neuron_layers.hpp:604:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t top_desc_;
^
In file included from ./include/caffe/vision_layers.hpp:10:0,
from src/caffe/layer_factory.cpp:6:
./include/caffe/common_layers.hpp:426:3: error: ‘cudnnHandle_t’ does not name a type
cudnnHandle_t handle_;
^
./include/caffe/common_layers.hpp:427:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t bottom_desc_;
^
./include/caffe/common_layers.hpp:428:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t top_desc_;
^
In file included from src/caffe/layer_factory.cpp:6:0:
./include/caffe/vision_layers.hpp:247:3: error: ‘cudnnHandle_t’ does not name a type
cudnnHandle_t* handle_;
^
./include/caffe/vision_layers.hpp:248:3: error: ‘cudaStream_t’ does not name a type
cudaStream_t* stream_;
^
./include/caffe/vision_layers.hpp:249:10: error: ‘cudnnTensorDescriptor_t’ was not declared in this scope
vector
^
./include/caffe/vision_layers.hpp:249:33: error: template argument 1 is invalid
vector
^
./include/caffe/vision_layers.hpp:249:33: error: template argument 2 is invalid
./include/caffe/vision_layers.hpp:250:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t bias_desc_;
^
./include/caffe/vision_layers.hpp:251:3: error: ‘cudnnFilterDescriptor_t’ does not name a type
cudnnFilterDescriptor_t filter_desc_;
^
./include/caffe/vision_layers.hpp:252:10: error: ‘cudnnConvolutionDescriptor_t’ was not declared in this scope
vector
^
./include/caffe/vision_layers.hpp:252:38: error: template argument 1 is invalid
vector
^
./include/caffe/vision_layers.hpp:252:38: error: template argument 2 is invalid
./include/caffe/vision_layers.hpp:449:3: error: ‘cudnnHandle_t’ does not name a type
cudnnHandle_t handle_;
^
./include/caffe/vision_layers.hpp:450:3: error: ‘cudnnTensorDescriptor_t’ does not name a type
cudnnTensorDescriptor_t bottom_desc_, top_desc_;
^
./include/caffe/vision_layers.hpp:451:3: error: ‘cudnnPoolingDescriptor_t’ does not name a type
cudnnPoolingDescriptor_t pooling_desc_;
^
./include/caffe/vision_layers.hpp:452:3: error: ‘cudnnPoolingMode_t’ does not name a type
cudnnPoolingMode_t mode_;
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
src/caffe/layer_factory.cpp: In function ‘boost::shared_ptrcaffe::Layer
}
^
make: *** [.build_release/src/caffe/layer_factory.o] Error 1
This tracker is for issues and bugs with Caffe; please ask installation and other usage questions on the caffe-users list. Thanks!
This is a bug with Caffe. cudnnTensorDescriptor_t doesn't exist in the header file of cuDNN v2. It has been renamed to cudnnTensor4dDescriptor_t.
Sorry, this is a false alarm. I just noticed that the error was caused by cuDNN R1(v1). Newly downloaded v2 works very well.
@futurely
Even if I used the cuDNN-v2(cudnn-6.5-linux-x64-v2.tgz from nvidia website) with the latest Caffe from this git repository, the problem is not resolved.
@Jeongseob The filenames of cuDNN v1 and v2 are the same. Please delete the existing cuDNN header file and shared library and copy the v2 files again.
@futurely Actually, I installed the cuDNN-v2 library on my home directory and just exported the LD_LIBRARY_PATH. I did not install the cuDNN v1.
It's much simpler to install them along with CUDA by
cd <cuDNN path>
sudo cp cudnn.h /usr/local/cuda/include
sudo cp libcudnn* /usr/local/cuda/lib64
## /usr/local/cuda/lib64 should have been added to LD_LIBRARY_PATH
sudo ldconfig
@futurely Do I have to install the cuDNN on the "/usr/local/cuda/" path? Actually, I do not want to install the cuDNN on the system-wide. Is there any problem if I just set the path to my own home directory?
There's no difference between using them with using any other libraries.
got this problem too, I used cuDNN v2 with latest caffe from the master. These are errors:
(If I use cuDNN v1, all will be compiled successfully)
CXX/LD -o .build_release/examples/mnist/convert_mnist_data.bin
.build_release/lib/libcaffe.so: undefined reference to `cudnnSetFilter4dDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cudnnGetConvolutionForwardAlgorithm'
.build_release/lib/libcaffe.so: undefined reference to `cv::imread(cv::String const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cudnnCreateTensorDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cv::imencode(cv::String const&, cv::_InputArray const&, std::vector<unsigned char, std::allocator<unsigned char> >&, std::vector<int, std::allocator<int> > const&)'
.build_release/lib/libcaffe.so: undefined reference to `cudnnDestroyTensorDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cudnnGetConvolutionForwardWorkspaceSize'
.build_release/lib/libcaffe.so: undefined reference to `cudnnAddTensor'
.build_release/lib/libcaffe.so: undefined reference to `cudnnSetPooling2dDescriptor'
.build_release/lib/libcaffe.so: undefined reference to `cv::imdecode(cv::_InputArray const&, int)'
.build_release/lib/libcaffe.so: undefined reference to `cudnnSetConvolution2dDescriptor'
collect2: error: ld returned 1 exit status
make: *** [.build_release/tools/convert_imageset.bin] Error 1
make: *** Waiting for unfinished jobs....
I solved the problem above by replacing old cuDNN files with v2 files in every paths that contain libcudnn*. In my case (Ubuntu 14.04):
user_Ubuntu:~/caffe-master$ locate libcudnn_static.a
/home/user/cudnn-6.5-linux-x64-v2/libcudnn_static.a
/lib64/libcudnn_static.a
/usr/lib/libcudnn/libcudnn_static.a
/usr/local/cuda-7.0/targets/x86_64-linux/lib/libcudnn_static.a
/usr/local/lib/libcudnn_static.a
So I did:
cd <cuDNN path>
sudo cp cudnn.h /usr/local/cuda/include
sudo cp libcudnn* /usr/local/cuda/lib64
# Add /usr/local/cuda/lib64 to LD_LIBRARY_PATH in ~/.bashrc
sudo cp libcudnn* /lib64/
sudo cp libcudnn* /usr/lib/libcudnn/
sudo cp libcudnn* /usr/local/cuda-7.0/targets/x86_64-linux/lib/
sudo cp libcudnn* /usr/local/lib
sudo ldconfig
Then caffe-master is compiled succesfully.
mark
Most helpful comment
I solved the problem above by replacing old cuDNN files with v2 files in every paths that contain libcudnn*. In my case (Ubuntu 14.04):
So I did:
Then caffe-master is compiled succesfully.