Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to get CUDA working, sample can't find helper_cuda.h

I just installed CUDA and have been following http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-mac-os-x/index.html

Everything works up until I try to copy a sample code such as deviceQuery to ~/Desktop and compile.

I get the following errors at compile:

/Developer/NVIDIA/CUDA-5.5/bin/nvcc -ccbin g++ -I../../common/inc  -m64 -Xcompiler -arch -Xcompiler x86_64   -gencode arch=compute_10,code=sm_10 -gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=\"sm_35,compute_35\" -o deviceQuery.o -c deviceQuery.cpp
deviceQuery.cpp:23:25: error: helper_cuda.h: No such file or directory
deviceQuery.cpp: In function ‘int main(int, char**)’:
deviceQuery.cpp:111: error: ‘SPRINTF’ was not declared in this scope
deviceQuery.cpp:116: error: ‘_ConvertSMVer2Cores’ was not declared in this scope
deviceQuery.cpp:206: error: ‘checkCudaErrors’ was not declared in this scope
deviceQuery.cpp:230: error: ‘checkCudaErrors’ was not declared in this scope
deviceQuery.cpp:241: error: ‘checkCudaErrors’ was not declared in this scope
make: *** [deviceQuery.o] Error 1

The code will compile and run in the CUDA directory and it is clear that the compiler can't find helper_cuda.h, I can't find it either does anyone have a solution?

like image 522
deltap Avatar asked Oct 14 '13 03:10

deltap


1 Answers

As indicated by your compile options -I../../common/inc, helper_cuda.h is located in $CUDA_HOME/samples/common/inc/.

If you want to copy the samples to a customized place, you have to copy the whole samples dir, or modify some code/compile options to include staff in common/ dir.

like image 111
kangshiyin Avatar answered Sep 18 '22 12:09

kangshiyin