'nvcc -ptx file.cu' fatal error: file not found

439 views Asked by At

I'm trying to build .ptx code using nvcc on the .cu files. For some it works and for some it produces a "file not found" error:

macair93278:matrixMul r8t$ nvcc -ptx matrixMul.cu
matrixMul.cu:36:10: fatal error: 'helper_functions.h' file not found
#include <helper_functions.h>
         ^
1 error generated.

but then when I try another file it works:

macair93278:matrixMulCUBLAS r8t$ cd ../matrixMulDrv/
macair93278:matrixMulDrv r8t$ ls
Makefile        NsightEclipse.xml   matrixMulDrv.cpp    readme.txt
Makefile-e      matrixMul.h     matrixMul_kernel.cu
macair93278:matrixMulDrv r8t$ nvcc -ptx matrixMul_kernel.cu
macair93278:matrixMulDrv r8t$ ls
Makefile        NsightEclipse.xml   matrixMulDrv.cpp    matrixMul_kernel.ptx
Makefile-e      matrixMul.h     matrixMul_kernel.cu readme.txt

Maybe when I ran

make     

on some of them my PATH variables were set differently? Any idea how to fix the ones that don't work? Thanks, bb

1

There are 1 answers

0
Robert Crovella On BEST ANSWER

Give nvcc the path to any include files needed. You do this in the same fashion that you would for gcc/g++. The only include files that you don't have to specify this for (with nvcc) are the default ones located in /usr/local/cuda/include

So if, on your machine, helper_functions.h is located in /usr/local/cuda/samples/common/inc, then compile like this:

nvcc -ptx -I/usr/local/cuda/samples/common/inc matrixMul.cu

The reason it works for matrixMul_kernel.cu is because that file does not have the

#include <helper_functions.h>

statement in it.