I have compiled some CUDA code to PTX and would like to use this PTX from a HOST-side function. As example, I have compiled PTX code with kernel that adds a vector, called
extern "C" __global__ KernVec(float *vec, float *result). I would then like to call this kernel from inside my HOST (CPP) function named, for example,
float myVectorAdd(float *vec). I know this is a trivial use of GPU, but I am just trying to learn this functionality if it exists.
I have found some information about cuModuleLoad and cuModuleGetFunction for passing the PTX filename and PTX function name respectively, to create a module. However, I would like to pass the entire PTX file (not just filename) to create a module that I can then employ in my CPP (HOST side) code. Is this possible? If so, can anyone provide a simple example of how this can be done?
Many thanks to anyone with some hint/help on how this can be accomplished.