Ah, yes I see. The thing to know is your OptiX code and your pure CUDA code need to be compiled differently, and so your pure CUDA kernels need to be in a separate file from any OptiX programs, this is why you see people creating a wrapper function.
The OptiX SDK cmake setup has a variable that you can set for each source file that can be used to compile CUDA kernels. Then you just need to link your program with the CUDA runtime.
Here’s an example of modifying the CMakeLists.txt file for optixHello to include a CUDA kernel:
Tag the CUDA kernel for OBJ format instead of PTX (PTX is the default for
OPTIX_add_sample_executable). Do this before calling OPTIX_add_sample_executable.
PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ
You’ll need to have the host function that uses triple chevrons inside your pure CUDA file (optixHello_cuda_kernel.cu) along with the device code that the kernel runs.
extern “C” host void