Calling Kernels from .cpp files ?

Hi Experts,

          In most of the SDK files, kernels are called from host functions in .cu files.           

Is it possible to call kernels from host functions in .cpp files…!..? External Image

Thanks in Advance,

karguvel

Using the runtime API, it is not possible. If you want to launch kernels from plain C or C++ code, you will need to write a wrapper function inside the .cu file which other code can call.

Thank you External Media

you cannot call directly kernel function in *.cpp file because the calling instruction must be compiled by nvcc (nvcc use for compiling *.cu file) so you have to

create a function (in *.cu file) to call the kernel function (let say that is buffer function). In this way, you can call this buffer function as a normal function.