Sanity check on calling CUDA templates from a cpp template class

Is defining a templated CUDA kernel in a .cu file and then #include-ing that in a header file containing a cpp template class acceptable? One of the functions in my cpp template class needs to call the CUDA kernel.

I’ve done this, and it compiles without any errors. I just wonder if I’m missing something seeing how you need to go through an extern C wrapper when not using templates.

You don’t need the extern C wrapper for linking anymore in any context. That’s an artifact of back when all CUDA code was treated as C and not C++, so you had to be very specific about the name mangling. However, that’s no longer the case; your code should still work if you extern C everything, but it’s no longer necessary or even recommended.

Fair enough, I guess the cppIntegration sample in the SDK needs updating then as it still uses extern C wrappers.