Skip to content
Snippets Groups Projects
Commit b41acf6f authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

CudaBadAlloc should clear the CUDA error in the constructor

parent 997a7931
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,15 @@ namespace Exceptions {
struct CudaBadAlloc
: public std::bad_alloc
{
CudaBadAlloc()
{
#ifdef HAVE_CUDA
// Make sure to clear the CUDA error, otherwise the exception handler
// might throw another exception with the same error.
cudaGetLastError();
#endif
}
const char* what() const throw()
{
return "Failed to allocate memory on the CUDA device: "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment