Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CUDA source files get a .cu extension. What do header files get?

Tags:

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?

like image 669
Brooks Moses Avatar asked Mar 06 '10 17:03

Brooks Moses


People also ask

What is the file extension of a header file?

A header file is a file with extension . h which contains C function declarations and macro definitions to be shared between several source files.

What is CUDA compiler file extension?

CUDA source files get a . cu extension.

Does the extension for your header file matter?

The extension of the header file doesn't matter because it is just inserted into the source file by the preprocessor.


2 Answers

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.

like image 82
Tom Avatar answered Sep 17 '22 17:09

Tom


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).

like image 21
Paul R Avatar answered Sep 19 '22 17:09

Paul R