I want to build a cuda plugin for an other project written in C++ using MPI.
I got the following situation:
- startingpoint.cpp is a c++ file including the cudaintegrator.h and
includes datastructure.h - cudaintegrator.h is the header file for a
cuda file including datastructure.h - cudaintegrator.cpp is the
implemenation of cudaintegrator.h - datastructure.h is a header file
specifing some datastructures
the files are organized like that:
/trunk/
/src
/folder1
/folder2
/startingpoint.cpp
/folder3
/cudaintegrator.h
/cudaintegrator.cpp
/folder4
/folder5
/datastructure.h
When I run nvcc from my trunk dir with the following command:
/usr/local/cuda/bin/nvcc -c -o src/folder1/folder3/cudaintegrator.o src/folder1/folder3/cudaintegrator.cu
the included file `#include “folder4/folder5/datastructure.h” is not found:
src/folder1/folder2/cudaintegrator.h:12:33: fatal error: folder4/folder5/datastructure.h: No such file or directory
When I run mpic++ for the compilation of startingpoint.cpp, which uses the same include, the datastructure.h is found.
I suspect that the working directory of nvcc and mpic++ are somehow different(?) even both are run from the trunk directory.
When I change the include to ../../folder4/folder5/datastructure.h the file itself is found, but subsequent includes fail for the same reason. I can not change the includes in all subsequent files because they can’t be found by mpic++ in this case.
Does anyone have a suggestion how I should include the files in this situation correctly, or how to instruct nvcc to find the included files?
Providing include paths (
-I) to the nvcc invocation should be enough (if not, it uses relative include paths only, that’s why adding../..works for a single include).