I assume we wish to do error handling such as described in this answer, where we test the return code and throw an exception if it is not success.
Now, suppose cudaEventDestroy
returns an error from a previous, asynchronous launch, as the documentation notes it may do.
In this situation, has the event been successfully destroyed? More generally, can I expect any runtime functions to have successfully completed their function if they return an errors from a previous, asynchronous launch?
What can I do if this happens at a place in my code where it is inconvenient to actually handle the error, such as a destructor?
It seems like, if I don't want my programs to either randomly terminate or lose track of errors that I would have to implement a duplicate error recording system where I can record errors that occur in places that can't really handle them, and change the boilerplate for making runtime API calls to check both the return status and my duplicate error recording system. This seems rather awkward and suboptimal and I'm hoping I'm missing something simple.