Darknet: Compile with GPU=1, curand.h: No such file or directory

Created on 29 Sep 2018  路  6Comments  路  Source: pjreddie/darknet

I am trying to compile darknet with GPU on Ubuntu 16.04. I have cuda-9.0 installed on my machine and I created a symlink in /usr/local/cuda that points to /usr/local/cuda-9.0 so that the default paths in the make file are correct. Darknet compiles fine without GPU but when I set GPU=1 I get the error:

gcc -Iinclude/ -Isrc/ -DGPU -I/usr/local/cuda/include/ -Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DGPU -c ./src/gemm.c -o obj/gemm.o
In file included from ./src/utils.h:5:0,
                 from ./src/gemm.c:2:
include/darknet.h:12:24: fatal error: curand.h: No such file or directory
compilation terminated.
Makefile:89: recipe for target 'obj/gemm.o' failed
make: *** [obj/gemm.o] Error 1

My initial guess is that for some reason the CURAND Library is not properly installed or something?

Most helpful comment

I just solved the exact same issue.
It happens because you only have the CUDA runtime and not the dev version.
You can try installing libcudnn7-dev, or starting from the devel tag in nvidia/cuda dockerhub. The dev package has the include files. From https://hub.docker.com/r/nvidia/cuda

devel: extends the runtime image by adding the compiler toolchain, the debugging tools, the headers and the static libraries. Use this image to compile a CUDA application from sources.

All 6 comments

Does curand.h exist on your system? Make sure the path is right.

@PeterQuinn925 haha ok that is a good place to start. I just ran sudo find / -type f -name "curand.h" and nothing came up.

in /usr/local/cuda/lib64 I do have libcurand.so.9.0 though...

I installed CUDA from apt. And on the tensorflow website it has a warning "Caution: apt installs the NVIDIA libraries and headers to locations that make it difficult to configure and debug build issues." So I guess I will try purging it all and installing from source

I find curand.h in the same directory that cudnn.h is in: ...NVIDA GPU Computing ToolkitCUDAv9.1include
My laptop with a GPU uses windows. I don't have the CUDA stuff installed on a Linux box so I don't know where it would go.

@PeterQuinn925 Did you find what was the problem? I got the exact same issue

@erivera1802 I got it working yesterday.

The first time I installed CUDA I followed the tensorflow documentation Install CUDA with apt. This only installs the necessary dependency to run cuda programs, but does not give you some of the development dependencies (i.e. .h files). After blowing away my CUDA install and reinstalling following the Linux CUDA install guide. It worked! I think the missing dependency was the 'cuda-libraries-dev-9.0' (see section 3.7.3 Meta Packages of the install guide).

Hope this helps!

I just solved the exact same issue.
It happens because you only have the CUDA runtime and not the dev version.
You can try installing libcudnn7-dev, or starting from the devel tag in nvidia/cuda dockerhub. The dev package has the include files. From https://hub.docker.com/r/nvidia/cuda

devel: extends the runtime image by adding the compiler toolchain, the debugging tools, the headers and the static libraries. Use this image to compile a CUDA application from sources.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AndyZX picture AndyZX  路  3Comments

TheHidden1 picture TheHidden1  路  3Comments

ivomarvan picture ivomarvan  路  3Comments

HoracceFeng picture HoracceFeng  路  3Comments

bujingdexin picture bujingdexin  路  3Comments