Skip to content

Instantly share code, notes, and snippets.

@sandeepkumar-skb
Last active January 29, 2021 23:29
Show Gist options
  • Save sandeepkumar-skb/eb5df966bc79acea09b47f2d505f8661 to your computer and use it in GitHub Desktop.
Save sandeepkumar-skb/eb5df966bc79acea09b47f2d505f8661 to your computer and use it in GitHub Desktop.
cuda error check
inline void gpuAssert(cudaError_t err, const char *file, int line)
{
if (err != cudaSuccess){
printf("%s in %s at line %d\n", cudaGetErrorString(err), file, line);
exit(EXIT_FAILURE);
}
}
#define gpuErrchk(ans) \
{ \
gpuAssert((ans), __FILE__, __LINE__); \
}
@sandeepkumar-skb
Copy link
Author

Usage:
gpuErrck(cudaMalloc(&d_A, size));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment