Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu 16.04, Nvidia toolkit 8.0 RC, darknet compilation error: expected a ";"

Tags:

c++

cuda

ubuntu

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 ?

like image 951
Serge Tyatin Avatar asked Sep 02 '16 08:09

Serge Tyatin


1 Answers

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
like image 80
Anton Avatar answered Nov 09 '22 01:11

Anton