I am working on a class that uses CUDA and I need a couple custom kernels (i.e. global void functions), but I can’t figure out where to place these functions.
How can I include them along side my class and compile it all into a .o file I can then link against the main executable?
EDIT: to clarify a bit, my program looks like the following:
cuda class (used in main program), compiled to .o with nvcc
main program, compiled with icc and linked against libraries
I need the cuda class to be able to call kernels (i.e. global void functions), but don’t know where to place these… I cannot place them in the main program.
Thanks for the posts. I don’t know what happened to my post (they were disappearing or hidden, but I think that’s fixed now) but I did find what I needed in the CppIntegration example inside the CUDA package.
I accomplished it doing essentially what you posted in the first post. I added a wrapper external “C” void function to call the kernel, then included that header in the class template, then included that header class template in the main program and it compiled and works fine. Thanks again.