I'm new to CUDA programming. In serial code I often have a function that I use for gracefully exiting code after an error occurs. E.g.
void exit_with_error(char * message){
fprintf(stderr, "%s", message);
fflush(stderr);
exit(1);
}
QUESTION : Is there a clean way to do that in the device code using CUDA 8.0?
I'm looking for something similar to what you can do in MPI. So if one thread on the GPU device encounters an 'error' (e.g. a conditional that should never be true), it
prints the error
sends a signal to all other threads to exit (possibly flushing their stdout/stderr buffers).
program terminates.