I have a file with a common set of CUDA device functions (not even one global function kernel). No host functions are in this file.
I include the file in two independent kernels and they compile fine.
The entire application successfully compiles and links in non-Debug mode.
Compiling and linking in Debug mode results in a “multiply defined symbols” linker error (LNK2005) for only those kernel functions that are not directly called by the including kernels or not called at all.
There are two cases and workarounds:
Functions that are only called by other functions in this included file produce “multiply defined symbols” link errors. Marking them as forceinline fixed those errors.
A function that is not used anywhere produces a multiply defined link error. Commenting it out entirely solved that problem (ugh).
I’m on VS2010 + CUDA 5.0.
Again, this is only an issue when compiling a Debug target and the kernels are independent.