-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.h
25 lines (23 loc) · 883 Bytes
/
common.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
#pragma once
#include <stdio.h>
static void HandleError(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 HANDLE_ERROR(err) (HandleError(err, __FILE__, __LINE__))
#define HANDLE_NULL(a) \
{ \
if (a == NULL) \
{ \
printf("Host memory failed in %s at line %d\n", \
__FILE__, __LINE__); \
exit(EXIT_FAILURE); \
} \
}