It’s not only that the compiler doesn’t catch it - there isn’t actually an exception thrown. Though i tried to do it the way you proposed - I get struck on “cudaInvalidDeviceFunction”, probably some sort of c++ mangling, but i really don’t figure out how to solve it.
Way of least resistance - executing shell function.
shell - not the thing you may consider as a shell…bad term. just an additional, superfluous function in the .cu file that does the <<<gs,bs>>> stuff, taking everything as a parameter. Currently i tried to avoid packing anything else than the kernels into the .cu file - looked some kind of clean.
char * - yes, i know… cudaLaunch(“kernelcall”);
Yes, I put most of my CUDA stuff into wrapper functions as well, as some of it’s C++ magic doesn’t go well together with other libraries.
The simplest way to figure out the mangled function names is to compile with [font=“Courier New”]-Xptxas=-v[/font], which will print them together with the memory use statistics for each kernel.
I don’t know this for sure, but in case it’s possible that the name extension (the character gobbledegoob named mangling) changes after some updates of nvcc, i stay away from hardcoded cudaLaunch(const char*) calls, since i don’t want to be responsible for the colleagues that are eating the carpet after spilling their coffee because of a sudden rage.