Last active
April 11, 2018 22:05
-
-
Save tonyyang-svail/67b6cb354dee3fb6eb53da29610760b8 to your computer and use it in GitHub Desktop.
This file contains 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
// https://stackoverflow.com/questions/14038589/what-is-the-canonical-way-to-check-for-errors-using-the-cuda-runtime-api | |
#define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); } | |
inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true) | |
{ | |
if (code != cudaSuccess) | |
{ | |
fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line); | |
if (abort) exit(code); | |
} | |
} | |
... | |
gpuErrchk(cudaGetDeviceCount(&dc)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment