Get the latest tech news

Asynchronous Error Handling Is Hard


Or, How I Learned To Stop Worrying And Deprecate cudaGetLastError()

allocateTwoBuffers() is not structured in a way that I’d publish in the CUDA Handbook, because a goto-based error handling idiom scales better if, say, the function is modified to allocate more resources on behalf of its caller. cudaPeekLastError() gives developers more creative control, but large bodies of code must carefully define their own protocols as to when these various error handling functions are called. Most developers do define macros, though, with names like SAFE_CUDA or CUDART_CHECK(my choice for the CUDA Handbook sample code before I refactored it to use Allan MacKinnon’s clever prefix-macro idiom).

Get the Android app

Or read this on Hacker News