My kernel is stored in a .h file, which I include into a .cu file, where the kernel is actually invoked
with triple chevrons. The .h file is expecting a number of #defines that I would like to programatically set for different instances of the kernel. This kernel is a port from OpenCL, where I could set the #defines when I built the kernel from source.
Here is what I would like to be able to do :
#include "my_kernel.h"
#define FOO 1
#define BAR 2
my_kernel<<<...>>>(...);
#define FOO 3
#define BAR 4
my_kernel<<<...>>>(...);
Is this possible, and if so what is the best approach ?
Thanks, @Robert_Crovella , I did try templating and it worked. For some #defines, I can’t get away with that as they determine which types are used in the kernel. So, in these cases, I will need separate .cu files, and will
put the #defines before the header inclusion.