The standard convention seems to be to give CUDA source-code files a .cu
extension, to distinguish them from C files with a .c
extension. What's the corresponding convention for CUDA-specific header files? Is there one?
views:
553answers:
2
+2
A:
No - just use .h for header files. The CUDA source files have a different suffix to make lt easy to ensure that the various source files in a build get compiled with the right compiler (think makefile rules).
Paul R
2010-03-06 19:15:35
+5
A:
Some people (including the CUDA SDK) use .cuh for CUDA header files, and if you're including device code in the header then perhaps this may help. However really there is no special meaning attached to the extension of the header file (unlike for the source file where it determines which compiler to use) so personally I stick with .h.
Tom
2010-03-06 19:41:29
Thanks! In some cases I do have device code in the header, and I'd like to make that clear in the file extension so that people won't include it in non-CUDA source files, so .cuh sounds like the right answer for that. (This is also an environment that distinguishes C++ .hpp headers from C .h ones, so there's local precedent.) Otherwise, yeah, .h makes sense.
Brooks Moses
2010-03-07 06:07:54