Reputation: 197
I am compiling Darknet on Ubuntu 16.04 with GPU support. Nvidial toolkit version 8.0 RC
And I get stuck with error:
nvcc --gpu-architecture=compute_52 --gpu-code=compute_52 -DOPENCV `pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options "-Wall -Wfatal-errors -Ofast -DOPENCV -DGPU" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o
/usr/local/cuda/include/surface_functions.h(134): error: expected a ";"
/usr/local/cuda/include/surface_functions.h(135): error: expected a ";"
/usr/local/cuda/include/surface_functions.h(136): error: expected a ";"
/usr/local/cuda/include/surface_functions.h at error lines has something like this:
template<> __device__ __cudart_builtin__ char surf1Dread(surface<void, cudaSurfaceType1D> surf, int x, enum cudaSurfaceBoundaryMode mode) asm("__surf1Dread_char") ;
Any advice ?
Upvotes: 7
Views: 9895
Reputation: 331
So it happens when your environment uses different versions of nvcc binary and cuda includes files during compilation process.
Darknet is using /usr/local/cuda/include/ as its include path but relys on you PATH when executing nvcc binary. And it could belong to your another cuda installation in the system.
To avoid this force your shell to search for nvcc in the /usr/local/cuda/bin/nvcc.
This could be done either by hacking nvcc path in the Makefile:
replace NVCC=nvcc with NVCC=/usr/local/cuda/bin/nvcc
or by modyfying PATH variable for make command (simpler and session related)
PATH=/usr/local/cuda/bin:$PATH make
Upvotes: 15
Reputation: 124
If you have several versions of CUDA installed and need them (like me), I recommend adding the following to your (BASH) RC:
# DARKNET
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
Source your RC ('. ~/.bashrc') and complilation works!
Upvotes: 11
Reputation: 197
This error is because of nvcc version 7.5
Looks like Cuda toolkit 8.0 RC installation via deb files does not have nvcc version 8 I have reinstalled cuda via cuda_8.0.27_linux.run installed and it works for me now
Upvotes: 4