OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

vt_cupti_events.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_EVENTS_H
14 #define VT_CUPTI_EVENTS_H
15
16 #if (defined(VT_CUPTI_EVENTS))
17
18 #include "vt_cupti.h"
19 #include "vt_inttypes.h" /* VampirTrace integer types */
20
21 /*
22 * VampirTrace CUPTI event (single linked list element)
23 */
24 typedef struct vtcuptievtevt_st
25 {
26 CUpti_EventID cuptiEvtID; /**< CUPTI event ID */
27 uint32_t vtCID; /**< VampirTrace counter ID */
28 /*CUpti_EventDomainID cuptiDomainID; *< CUPTI domain ID */
29 struct vtcuptievtevt_st *next;
30 }vt_cuptievt_evt_t;
31
32 /*
33 * Structure that stores events to be trace for specific device capability
34 * (single linked list element)
35 */
36 typedef struct vtcuptievtdev_st
37 {
38 int dev_major; /**< Major CUDA device capability */
39 int dev_minor; /**< Minor CUDA device capability */
40 CUdevice cuDev; /**< CUDA device */
41 vt_cuptievt_evt_t *vtcuptiEvtList; /**< list of events to be traced for this device*/
42 size_t evtNum; /**< Number of tracable CUPTI events */
43 struct vtcuptievtdev_st *next;
44 }vt_cuptievt_dev_t;
45
46 /*
47 * VampirTrace CUPTI event group and its counters and properties.
48 */
49 typedef struct vtcuptievtgrp_st
50 {
51 CUpti_EventGroup evtGrp; /**< CUPTI event group, created for this context */
52 CUpti_EventID *cuptiEvtIDs; /**< CUPTI event IDs to be traced */
53 uint32_t *vtCIDs; /**< VampirTrace counter ids */
54 size_t evtNum; /**< number of CUPTI events in this group */
55 uint8_t enabled; /**< is the threads CUPTI capturing enabled */
56 struct vtcuptievtgrp_st *next;
57 }vt_cuptievt_grp_t;
58
59 /*
60 * The VampirTrace CUPTI context has the CUDA context as key and contains
61 * further information about its device and counters.
62 */
63 typedef struct vtcuptievtctx_st
64 {
65 CUcontext cuCtx; /**< CUDA context (primary key) */
66 vt_cuptievt_dev_t *vtDevCap; /**< pointer to device capability (events, ...) */
67 vt_cuptievt_grp_t *vtGrpList; /**< list of VT CUPTI event groups */
68 uint64_t *counterData; /**< preallocated buffer for counter data */
69 CUpti_EventID *cuptiEvtIDs; /**< preallocated buffer for CUPTI event IDs*/
70 struct vtcuptievtctx_st *next;
71 }vt_cuptievt_ctx_t;
72
73 /*
74 * Initialize Mutex, VampirTrace IDs and registers the finalize function.
75 * This may be done implicitly by vt_cuptievt_count().
76 */
77 void vt_cupti_events_init(void);
78
79 /*
80 * Finalizes the VampirTrace CUPTI implementation.
81 */
82 void vt_cupti_events_finalize(void);
83
84 /*
85 * Finalizes CUPTI device.
86 *
87 * @param ptid the VampirTrace process/thread id
88 * @param cleanExit 1 to cleanup CUPTI event group, otherwise 0
89 */
90 void vt_cuptievt_finalize_device(uint32_t ptid, uint8_t cleanExit);
91
92
93 /*
94 * Returns the VampirTrace CUPTI context for the CUDA context associated with
95 * the calling host thread.
96 *
97 * @param ptid the VampirTrace thread id of the calling host thread
98 */
99 vt_cuptievt_ctx_t* vt_cuptievt_getCurrentContext(uint32_t ptid);
100
101 /*
102 * Request the CUTPI counter values and write it to the given VampirTrace
103 * stream with the given timestamps.
104 *
105 * @param vtcuptiCtx pointer to the VampirTrace CUPTI context
106 * @param strmid the stream id for the counter values
107 * @param time the VampirTrace timestamps
108 */
109 void vt_cuptievt_writeCounter(vt_cuptievt_ctx_t *vtcuptiCtx, uint32_t strmid,
110 uint64_t *time);
111
112 /*
113 * Reset the VampirTrace counter values (to zero) for active CUPTI counters.
114 *
115 * @param vtcuptiCtx pointer to the VampirTrace CUPTI context
116 * @param strmid the stream id for the counter values
117 * @param time the VampirTrace timestamps
118 */
119 void vt_cuptievt_resetCounter(vt_cuptievt_ctx_t *vtcuptiCtx, uint32_t strmid,
120 uint64_t *time);
121
122 #endif /* VT_CUPTI_EVENTS */
123
124 #endif /* VT_CUPTI_EVENTS_H */
125