forked from iandobbie/CUDA_SIMrecon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cutilSafeCall.h
27 lines (24 loc) · 935 Bytes
/
cutilSafeCall.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef CUTIL_SAVE_CALL_H
#define CUTIL_SAVE_CALL_H
#include <cstdio>
// utilities for safe cuda api calls copied from cuda sdk.
// (currently these aren't exported -- file local)
#define cutilSafeCallNoSync(err) __cudaSafeCallNoSync(err, __FILE__, __LINE__)
#define cutilSafeCall(err) __cudaSafeCall (err, __FILE__, __LINE__)
inline static void __cudaSafeCall(cudaError_t err, const char *file, const int line)
{
if (cudaSuccess != err) {
fprintf(stderr, "%s(%i) : cudaSafeCall() Runtime API error %d: %s.\n",
file, line, (int)err, cudaGetErrorString(err));
exit(-1);
}
}
inline static void __cudaSafeCallNoSync(cudaError_t err, const char *file, const int line)
{
if (cudaSuccess != err) {
fprintf(stderr, "%s(%i) : cudaSafeCallNoSync() Runtime API error %d : %s.\n",
file, line, (int)err, cudaGetErrorString(err));
exit(-1);
}
}
#endif