What is the accepted way to report a custom error condition detected in a kernel to the host program? global functions can only return void and I would not expect a possibility to throw an exception.
Of course I can place an error code or message into global memory, but is there some API for it?
Nvidia recently released an official cuPrintf() library (well, source code), but someone one this forum did something similar on their own a while back…search the forum and see if you can find it. The techniques used will be pretty similar to what you need.