OpenMPI  0.1.1
vt_cupti.h
1 /**
2  * VampirTrace
3  * http://www.tu-dresden.de/zih/vampirtrace
4  *
5  * Copyright (c) 2005-2012, ZIH, TU Dresden, Federal Republic of Germany
6  *
7  * Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing
8  * Centre, Federal Republic of Germany
9  *
10  * See the file COPYING in the package base directory for details
11  **/
12 
13 #ifndef VT_CUPTI_H
14 #define VT_CUPTI_H
15 
16 #ifdef __cplusplus
17 # define EXTERN extern "C"
18 #else
19 # define EXTERN extern
20 #endif
21 
22 /* Disable all compiler warnings before including the actual
23  CUPTI header file. */
24 #ifdef __GNUC__
25 # pragma GCC system_header
26 #endif /* __GNUC__ */
27 #include "cupti.h"
28 
29 #define VT_CUPTI_CALL(_err, _msg) \
30  if(_err != CUPTI_SUCCESS){ \
31  vt_cupti_handleError(_err, _msg,__FILE__, __LINE__); \
32  }
33 
34 /* flag: tracing of cudaMalloc*() and cudaFree*() enabled? */
35 EXTERN uint8_t vt_cupti_trace_gpu_mem;
36 
37 /* flag: tracing of kernels enabled? */
38 EXTERN uint8_t vt_cupti_trace_kernels;
39 
40 /* flag: tracing of (asynchronous) memory copies enabled? */
41 EXTERN uint8_t vt_cupti_trace_mcpy;
42 
43 /* CUPTI global CUDA kernel counter group ID */
44 EXTERN uint32_t vt_cupti_cgid_cuda_kernel;
45 
46 /* GPU memory allocation counter */
47 EXTERN uint32_t vt_cupti_cid_cudaMalloc;
48 
49 /* global counter IDs for CUPTI callback and activity API */
50 EXTERN uint32_t vt_cupti_cid_blocksPerGrid;
51 EXTERN uint32_t vt_cupti_cid_threadsPerBlock;
52 EXTERN uint32_t vt_cupti_cid_threadsPerKernel;
53 
54 /*
55  * Handles errors returned from CUPTI function calls.
56  *
57  * @param ecode the CUDA driver API error code
58  * @param msg a message to get more detailed information about the error
59  * @param the corresponding file
60  * @param the line the error occurred
61  */
62 EXTERN void vt_cupti_handleError(CUptiResult err, const char* msg,
63  const char *file, const int line);
64 
65 #endif /* VT_CUPTI_H */
66