Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Name headers .cuh and .h as appropriate #78

Open
ptheywood opened this issue Nov 2, 2018 · 2 comments
Open

Name headers .cuh and .h as appropriate #78

ptheywood opened this issue Nov 2, 2018 · 2 comments
Labels
breaking-change Priority: Low v1.5-parity Issues related to FLAME GPU 1 parity.

Comments

@ptheywood
Copy link
Member

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.

@Robadob
Copy link
Member

Robadob commented Oct 10, 2019

I hope you aren't suggesting we rename cuda_runtime.h, that's part of the CUDA toolkit!

@ptheywood
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change Priority: Low v1.5-parity Issues related to FLAME GPU 1 parity.
Projects
None yet
Development

No branches or pull requests

3 participants