Trying to make CUDA work, the sample cannot find helper_cuda.h

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

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

I get the following compilation errors:

/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 is it clear that the compiler cannot find helper_cuda.h, I cannot find it, or does anyone have a solution?

+7
compiler-construction compilation compiler-errors cuda
source share
2 answers

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

If you want to copy the samples to a custom location, you need to copy the entire samples directory or change some code / compilation options to include staff in the common/ directory.

+18
source share

http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#environment-setup

The NVIDIA CUDA Toolkit includes sample programs in source form. You must compile them by changing them to ~ / NVIDIA_CUDA-8.0_Samples and typing make. The resulting binaries will be placed in ~ / NVIDIA_CUDA-8.0_Samples / bin

Just make sure:

$ export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}

$ export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64\ ${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

$ nvcc -V

Must show version.

$ cd ~/some_path/NVIDIA_CUDA-8.0_Samples

$ make

0
source share

All Articles