FLAMEGPU2
FLAMEGPU2 copied to clipboard
Name headers .cuh and .h as appropriate
Cmake uses the appropriate compiler based on the extension of teh file. i.e .cpp
files will use g++
while .cu
files will use nvcc
.
Visual studio with cuda enabled will pass all files through nvcc
.
This means that including cuda related headers in a .cpp
file will work under windows but not linux.
I.e.
In file included from /home/ptheywood/code/flamegpu/flamegpu2_dev/include/flamegpu/runtime/flame_functions_api.h:14:0,
from /home/ptheywood/code/flamegpu/flamegpu2_dev/include/flamegpu/model/AgentFunctionDescription.h:22,
from /home/ptheywood/code/flamegpu/flamegpu2_dev/include/flamegpu/model/AgentDescription.h:22,
from /home/ptheywood/code/flamegpu/flamegpu2_dev/include/flamegpu/model/ModelDescription.h:22,
from /home/ptheywood/code/flamegpu/flamegpu2_dev/include/flamegpu/io/statereader.h:15,
from /home/ptheywood/code/flamegpu/flamegpu2_dev/include/flamegpu/io/xmlReader.h:14,
from /home/ptheywood/code/flamegpu/flamegpu2_dev/src/flamegpu/io/xmlReader.cpp:16:
/home/ptheywood/code/flamegpu/flamegpu2_dev/include/flamegpu/gpu/CUDAErrorChecking.h:16:26: fatal error: cuda_runtime.h: No such file or directory
The file xmlReader.cpp
is compiled by g++, but tthrough the inclusion chain it attempts to include cuda_runtime.h
which is not available.
Using the appropriate naming convention should help us to not include cuda files in cpp files.
I hope you aren't suggesting we rename cuda_runtime.h
, that's part of the CUDA toolkit!
Renaming flame_functions_api.h
to flame_functions_api.cuh
would let cmake correctly handle it as a cuda file and use nvcc
rather than a host c compiler, with appropriate flags to actually find cuda_runtime.h