-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcutil.h
More file actions
37 lines (32 loc) · 1.12 KB
/
cutil.h
File metadata and controls
37 lines (32 loc) · 1.12 KB
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
28
29
30
31
32
33
34
35
36
37
#ifndef _CUTIL_H
#define _CUTIL_H
#include "types.h"
#define cutilSafeCall(err) __cudaSafeCall (err, __FILE__, __LINE__)
#define cutilCheckMsg(msg) __cutilCheckMsg (msg, __FILE__, __LINE__)
inline void __cudaSafeCall( cudaError err, const char *file, const int line )
{
cudaThreadSynchronize();
if( cudaSuccess != err) {
printf("%s(%i) : cudaSafeCall() Runtime API error (%i): %s.\n",
file, line, err, cudaGetErrorString( err) );
exit(-1);
}
}
inline void __cutilCheckMsg( const char *errorMessage, const char *file, const int line )
{
cudaError_t err = cudaGetLastError();
if( cudaSuccess != err) {
printf("%s(%i) : cutilCheckMsg() CUTIL CUDA error : %s : %s.\n",
file, line, errorMessage, cudaGetErrorString( err) );
exit(-1);
}
//#ifdef _DEBUG
err = cudaThreadSynchronize();
if( cudaSuccess != err) {
printf("%s(%i) : cutilCheckMsg cudaThreadSynchronize error: %s : %s.\n",
file, line, errorMessage, cudaGetErrorString( err) );
exit(-1);
}
//#endif
}
#endif