-
Notifications
You must be signed in to change notification settings - Fork 8
/
cudacommon.h
41 lines (30 loc) · 928 Bytes
/
cudacommon.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
39
40
41
#ifndef _CUDACOMMON_H
#define _CUDACOMMON_H 1
#include <cuda.h>
#include <cuda_runtime_api.h>
#include <stdio.h>
#ifdef _MSC_VER
#include <stdint.h>
#endif
#ifdef __cplusplus
/* cpp + CUDA only code */
#define CUDA_CHECK(action) cuda_check(action, #action, __FILE__, __LINE__)
inline void cuda_check(cudaError_t status, const char *action=NULL, const char *file=NULL, int32_t line=0) {
if (status != cudaSuccess) {
fprintf (stderr, "CUDA error (%d) occurred: %s\n", status, cudaGetErrorString(status));
if (action!=NULL)
fprintf (stderr, "While running %s (file %s, line %d)\n", action, file, line);
exit(EXIT_FAILURE);
}
}
void kernel_info(const void* func, int verbose);
#endif
#ifdef __cplusplus
extern "C" {
#endif
int get_device_prop(int device, struct cudaDeviceProp *deviceProp);
int select_and_init_GPU (int, unsigned int*, int);
#ifdef __cplusplus
}
#endif
#endif /* _CUDACOMMON_H */