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?
A header file is a file with extension . h which contains C function declarations and macro definitions to be shared between several source files.
CUDA source files get a . cu extension.
The extension of the header file doesn't matter because it is just inserted into the source file by the preprocessor.
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
.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With