First download cuDNN from NVIDIA: https://developer.nvidia.com/cudnn and then put the header and library files in the corresponding path on your machine.
I already did that and the error was the same.
Then I saw that the cuda toolkit can be downloaded with apt (I'm on Ubuntu 14.04) and I prefer to do it with apt. In the Makefile.config there are these lines:
" On Ubuntu 14.04, if cuda tools are installed via
"sudo apt-get install nvidia-cuda-toolkit" then use this instead:
CUDA_DIR := /usr"
So it should work. Any suggestion?
You need to manually put cudnn.hpp in your cuda/include folder.
I thought so, but it's cudnn.h, cudnn.hpp is already there
In Ubuntu14.04, you can place cudnn.h into /usr/include and set the proper permission of it.
Yes, but where can I find cudnn.h? I've already dowloaded the installer from https://developer.nvidia.com/cudnn and installed the toolkit. That file is missing.
You don't need to download the installer from the https://developer.nvidia.com/cudnn
At the bottom of that page you can see the "Download" button;
After you register as a developer in nvidia and finish a survey of cudnn, then you can have the permission to download the cudnn6.5 library for Linux/Windows.
If you can't get that library, maybe I can email that to you.
Ah thank you very much. I was so tired I didn't see the button. Now I'll try to include the cudnn.h file.
Just a little and I'll mark this issue as closed.
By the way you confirm that I can run caffe with CUDA without problem even if I installed the libraries by
sudo apt-get install nvidia-cuda-toolkit
?
On my server, aptitude reports:
Package: nvidia-cuda-toolkit
Version: 5.5.22-3ubuntu1
which seems to suggest that this is cuda 5.5. Latest cuda AFAIK is 6.5. CuDNN works against 6.5 AFAIK. From there you know what you should do :)
Hey I thought I closed this lots of days ago. Btw thank you Beniz and dreammingo. :) It works
@dreamingo I have downloaded cudnn6.5 library, and place cudnn.h into /usr/include, and I tried to make all , the error of 'cannot find cudnn.h' is gone.
But more errors come out
./include/caffe/util/cudnn.hpp:11:28: note: in definition of macro ‘CUDNN_CHECK’
cudnnStatus_t status = condition; \
^
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:5:
./include/caffe/neuron_layers.hpp: At global scope:
./include/caffe/neuron_layers.hpp:467:3: error: ‘cudnnTensor4dDescriptor_t’ does not name a type
cudnnTensor4dDescriptor_t bottom_desc_;
src/caffe/layer_factory.cpp: In function ‘caffe::SoftmaxLayer<Dtype>* caffe::GetSoftmaxLayer(const string&, const caffe::LayerParameter&) [with Dtype = float; std::string = std::basic_string<char>]’:
src/caffe/layer_factory.cpp:167:1: warning: control reaches end of non-void function [-Wreturn-type]
}
src/caffe/layer_factory.cpp: In function ‘caffe::PoolingLayer<Dtype>* caffe::GetPoolingLayer(const string&, const caffe::LayerParameter&) [with Dtype = double; std::string = std::basic_string<char>]’:
src/caffe/layer_factory.cpp:59:1: warning: control reaches end of non-void function [-Wreturn-type]
I don't know why there are so many errors, and I wonder is it because I have't set the permission on the cudnn.h in the path of /usr/include
Hi, xsz. I have no idea about what's going wrong with you compilation.Can
you compile it successfully without the cudnn flag? I found an issue
related to your situation in google-group. Here is the link:
https://groups.google.com/forum/#!topic/caffe-users/7Quck_AD9AA
In the last comment an user said that:
"I hand very similar error today. Looks like caffe is not ready for
last CuDNN R2. I've downloaded R1 version and everything built with no
errors and passed all tests.
Maybe you may have to check the version of cudnn.
"
On Sat, Dec 20, 2014 at 7:47 PM, xsz [email protected] wrote:
@dreamingo https://github.com/dreamingo I have downloaded cudnn6.5
library, and place cudnn.h into /usr/include, and I tried to make all , the
error of 'cannot find cudnn.h' is gone.
But more errors come out./include/caffe/util/cudnn.hpp:11:28: note: in definition of macro ‘CUDNN_CHECK’
cudnnStatus_t status = condition; \
^
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:5:
./include/caffe/neuron_layers.hpp: At global scope:./include/caffe/neuron_layers.hpp:467:3: error: ‘cudnnTensor4dDescriptor_t’ does not name a type
cudnnTensor4dDescriptor_t bottom_desc_;src/caffe/layer_factory.cpp: In function ‘caffe::SoftmaxLayer
* caffe::GetSoftmaxLayer(const string&, const caffe::LayerParameter&) [with Dtype = float; std::string = std::basic_string ]’:
src/caffe/layer_factory.cpp:167:1: warning: control reaches end of non-void function [-Wreturn-type]
}
src/caffe/layer_factory.cpp: In function ‘caffe::PoolingLayer* caffe::GetPoolingLayer(const string&, const caffe::LayerParameter&) [with Dtype = double; std::string = std::basic_string ]’:
src/caffe/layer_factory.cpp:59:1: warning: control reaches end of non-void function [-Wreturn-type]I don't know why there are so many errors, and I wonder is it because I
have't set the permission on the cudnn.h in the path of /usr/include—
Reply to this email directly or view it on GitHub
https://github.com/BVLC/caffe/issues/1325#issuecomment-67733260.
In my case, cudnn.h took place in /opt/cudnn/cuda/include/ by unknown.
Hello, I met the same issue in the beginning. I have fixed it now by doing these.
https://developer.nvidia.com/cudnn
resigier and download cudnn-7.0-linux-x64-v4.0-rc.tgz
explode file in ~/ directory
I had the same problem, I thought installing cuda tool-kit would install everything,! apparently I was wrong!.
So as @synchro-- and @dreamingo suggested, I downloaded the cuddn library package ( in my case (cudnn-7.0-linux-x64-v3.0-prod.tgz) and after extracting its contetnt (include and lib64 directories) I placed their contents in the usr/include and usr/lib respectively . everything compiled just fine.
Good Morning,
The file 'cudnn.h' is located in the foler where you have installed your 'cudnn', for exemple :
cp lib64/* /usr/local/cuda/lib64/
cp include/cudnn.h /usr/local/cuda/include/
so you have to edit the Makefile.config which is in the caffe root folder,
-- edit Makefile.config ---
uncomment this line "USE_CUDNN := 1" for acceleration GPU
add /usr/local/cuda/include/ to INCLUDE_DIRS ( just add withspace between two path)
and add /usr/local/cuda/lib64/ to LIBRARY_DIRS ( just add withspace between two path)
cordially.
I would suggest not to copy the cudnn library files into /usr/local/cuda directory. This may create issues with newer versions of the library.
An easier solution is to modify the Makefile.config:
add
and add
and edit your .bashrc file adding the following line:
export LD_LIBRARY_PATH=
Notice that at the moment, caffe supports cudnn v4.0 not v5.0 (current version)
After downloading CuDNN library folder in tgz format you get cudnn.h in /cuda/include folder, then I did so:
sudo cp /home/jalal/cudnn/cuda/include/cudnn.h /usr/include/
Is it possible to link caffe to a local cudnn installation instead of copying the include and lib64 files?
I tried to change cuda.cmakelists , but its not successful
In Makefile I changed GPU=1 CUDNN=1 OPENCV=0. but initially It was giving error this.
ubuntu@ip-10-0-0-226:~/$ make
gcc -DGPU -I/usr/local/cuda-7.0/include/ -DCUDNN -Wall -Wfatal-errors -Ofast -DGPU -DCUDNN -c ./src/gemm.c -o obj/gemm.o
In file included from ./src/gemm.c:3:0:
./src/cuda.h:15:19: fatal error: cudnn.h: No such file or directory
#include "cudnn.h"
^
compilation terminated.
make: *** [obj/gemm.o] Error 1
And when I included the cudnn.h in /usr/include/ it is giving this error.
ubuntu@ip-10-0-0-226:~/$ make
gcc -DGPU -I/usr/local/cuda-7.0/include/ -DCUDNN -Wall -Wfatal-errors -Ofast -DGPU -DCUDNN -c ./src/gemm.c -o obj/gemm.o
In file included from ./src/cuda.h:15:0,
from ./src/gemm.c:3:
/usr/include/cudnn.h:54:0: error: unterminated #if
#if !defined(CUDNN_H_)
^
compilation terminated due to -Wfatal-errors.
make: *** [obj/gemm.o] Error 1
Please tell me how can I solve this error.
Under windows, you need to take the three folders included in cudnn-7.5-windows7-x64-v5.0-ga.zip (or other CUDNN archive) and copy them into your CUDA folder (e.g. "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5"). If you extract the .zip directly there, then it will make "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\Cuda" and put the folders there. But they need to be directly in "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5"!
(That was the simple solution that took me so long to find)
Install cudnn runtime library & developer library, both of them.
Most helpful comment
I would suggest not to copy the cudnn library files into /usr/local/cuda directory. This may create issues with newer versions of the library./cuda/include/ to INCLUDE_DIRS ( just add withspace between two path)/cuda/lib64/ to LIBRARY_DIRS ( just add withspace between two path)
An easier solution is to modify the Makefile.config:
add
and add
and edit your .bashrc file adding the following line:/cuda/lib64/:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH=
Notice that at the moment, caffe supports cudnn v4.0 not v5.0 (current version)