Skip to content

Instantly share code, notes, and snippets.

@ugovaretto
Created July 24, 2012 09:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ugovaretto/3169151 to your computer and use it in GitHub Desktop.
Save ugovaretto/3169151 to your computer and use it in GitHub Desktop.
Check cuda error
#define CHECK_ERROR( err ) \
if( err != cudaSuccess ) { \
std::cerr << "ERROR: " << cudaGetErrorString( err ) << std::endl; \
exit( -1 ); \
}
#define CHECK_LAST_ERROR \
{ cudaError_t err = cudaGetLastError(); \
if( err != cudaSuccess ) { \
std::cerr << cudaGetErrorString( err ) << std::endl; \
exit( -1 ); \
} \
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment