-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdefines.h
38 lines (30 loc) · 843 Bytes
/
defines.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
28
29
30
31
32
33
34
35
36
37
38
/*
* Copyright (C) 2015-2018, Nils Moehrle
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD 3-Clause license. See the LICENSE.txt file for details.
*/
#ifndef CACC_DEFINES_HEADER
#define CACC_DEFINES_HEADER
#define CACC_NAMESPACE_BEGIN namespace cacc {
#define CACC_NAMESPACE_END }
#include <iostream>
#include <cuda_runtime.h>
CACC_NAMESPACE_BEGIN
#define CHECK(CALL) \
do { \
cudaError_t err = (CALL); \
if (cudaSuccess != err) { \
std::cerr << "CUDA error in " \
<< __FILE__ << ":" << __LINE__ << " (" << #CALL << "): " \
<< cudaGetErrorString(err) << " (" << err << ")" << std::endl; \
std::exit(EXIT_FAILURE); \
} \
} while(0)
enum Location {
HOST,
DEVICE
};
CACC_NAMESPACE_END
#endif /* CACC_DEFINES_HEADER */