I'm in a situation where I desperately need virtual functions in a kernel. I know that you can't use objects created in host memory in kernels if they have virtual functions.
If i use placement new
with a device pointer allocated by cudaMallocManaged
, can I pass that to a kernel and use its virtual functions properly?
The reason I'm asking and not just trying it is because I have a load of other issues with implementing this, and was wondering if it was even possible, because if it isn't I could try the more complicated, but definitely working method explained here.