cuda-api-wrappers
cuda-api-wrappers copied to clipboard
Consider using <system_error> for wrapping CUDA errors with exceptions
At the moment, our CUDA error wrapper code is almost entirely custom-written, tying exceptions to CUDA error codes. C++11 has a similar mechanism for wrapping libc and other similar "system errors" involving error codes returned by API calls; that is the std::system_error class and its associated std::error_code (both from the <system_error> header). I think these might be usable for CUDA errors as well; and that would be a nice win, cutting out dozens of LOC.
Further reading on <system_error>: A series of posts on the Think Async blog,