Last active
January 29, 2021 23:29
-
-
Save sandeepkumar-skb/eb5df966bc79acea09b47f2d505f8661 to your computer and use it in GitHub Desktop.
cuda error check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__); \ | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage:
gpuErrck(cudaMalloc(&d_A, size));