Skip to content

Instantly share code, notes, and snippets.

@jefflarkin
Created April 15, 2013 20:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jefflarkin/5390992 to your computer and use it in GitHub Desktop.
Save jefflarkin/5390992 to your computer and use it in GitHub Desktop.
A simple macro for checking errors after CUDA library calls.
//Macro for checking cuda errors following a cuda launch or api call
#define cudaCheckError() { \
cudaError_t e=cudaGetLastError(); \
if(e!=cudaSuccess) { \
printf("Cuda failure %s:%d: '%s'\n",__FILE__,__LINE__,cudaGetErrorString(e)); \
exit(0); \
} \
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment