0
votes

I want to compile the Darknet framework for machine learning on my PC with GPU support. However I call make I will get a segmentation fault:

nvcc  -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -Iinclude/ -Isrc/ -DOPENCV `pkg-config --cflags opencv`  -DGPU -I/usr/local/cuda/include/ --compiler-options "-Wall -Wno-unused-result -Wno-unknown-pragmas -Wfatal-errors -fPIC -Ofast -DOPENCV -DGPU" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o
Segmentation fault (core dumped)
Makefile:92: recipe for target 'obj/convolutional_kernels.o' failed
make: *** [obj/convolutional_kernels.o] Error 139

nvidia-smi gives me following information:

NVIDIA-SMI 418.87.01    Driver Version: 418.87.01    CUDA Version: 10.1

When I do nvcc --version I get:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

The CUDA Version 10.1 is not the same as the Verions 9.1 of the Cuda compilation tools. Could this be the problem? NVCC is installed via apt install nvidia-cuda-toolkit

2
The nvidia-smi version shown has nothing whatsoever to do with what version of the CUDA toolkit you have installed. It only shows what the installed driver supports - talonmies

2 Answers

2
votes

Just gonna post my solution here because I figured out the actual reason for this. So the reason this happens is because it's running a different binary than the actual one darknet wants to run. At least for me, which nvcc gave me /usr/bin/nvcc. The actual nvcc you want is located in /usr/local/cuda-11.1/bin (version number might be different obviously). So all you need to do is prepend (important!) this that directory to your PATH variable.

export PATH=/usr/local/cuda-11.1/bin${PATH:+:${PATH}} >> ~/.bashrc

Source:https://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions

I recommend you follow the link because there are a couple more mandatory post-installation steps that I also did not follow.

1
votes

I solved the problem. After installing cuda the actual binary of nvcc is at /usr/local/cuda/bin/nvcc. Creating a symbolic link in /usr/bin/ to this binary solved the problem.