This file implements a PAPI component that enables PAPI-C to access hardware monitoring counters for NVIDIA GPU devices through the CuPTI library.
More...
Go to the source code of this file.
|
| static int | cuda_init_component (int cidx) |
| |
| static int | cuda_shutdown_component (void) |
| |
| static int | cuda_init_thread (hwd_context_t *ctx) |
| |
| static int | cuda_shutdown_thread (hwd_context_t *ctx) |
| |
| static int | cuda_ntv_enum_events (unsigned int *event_code, int modifier) |
| |
| static int | cuda_ntv_code_to_name (unsigned int event_code, char *name, int len) |
| |
| static int | cuda_ntv_name_to_code (const char *name, unsigned int *event_code) |
| |
| static int | cuda_ntv_code_to_descr (unsigned int event_code, char *descr, int len) |
| |
| static int | cuda_init_control_state (hwd_control_state_t *ctl) |
| |
| static int | cuda_set_domain (hwd_control_state_t *ctrl, int domain) |
| |
| static int | cuda_update_control_state (hwd_control_state_t *ctl, NativeInfo_t *ntv_info, int ntv_count, hwd_context_t *ctx) |
| |
| static int | cuda_cleanup_eventset (hwd_control_state_t *ctl) |
| |
| static int | cuda_start (hwd_context_t *ctx, hwd_control_state_t *ctl) |
| |
| static int | cuda_stop (hwd_context_t *ctx, hwd_control_state_t *ctl) |
| |
| static int | cuda_read (hwd_context_t *ctx, hwd_control_state_t *ctl, long long **val, int flags) |
| |
| static int | cuda_reset (hwd_context_t *ctx, hwd_control_state_t *ctl) |
| |
| static int | cuda_init_private (void) |
| |
| static int | check_n_initialize (void) |
| |
| static int | cuda_ntv_code_to_descr (unsigned int event_code, char *descr, int __attribute__((unused)) len) |
| |
| static int | cuda_init_thread (hwd_context_t __attribute__((unused)) *ctx) |
| |
| static int | cuda_shutdown_thread (hwd_context_t __attribute__((unused)) *ctx) |
| |
| static int | cuda_init_control_state (hwd_control_state_t __attribute__((unused)) *ctl) |
| |
| static int | cuda_set_domain (hwd_control_state_t __attribute__((unused)) *ctrl, int domain) |
| |
| static int | cuda_update_control_state (hwd_control_state_t *ctl, NativeInfo_t *ntv_info, int ntv_count, __attribute__((unused)) hwd_context_t *ctx) |
| |
| static int | cuda_start (hwd_context_t __attribute__((unused)) *ctx, hwd_control_state_t *ctl) |
| |
| int | cuda_stop (hwd_context_t __attribute__((unused)) *ctx, hwd_control_state_t *ctl) |
| |
| static int | cuda_read (hwd_context_t __attribute__((unused)) *ctx, hwd_control_state_t *ctl, long long **val, int __attribute__((unused)) flags) |
| |
| static int | cuda_reset (hwd_context_t __attribute__((unused)) *ctx, hwd_control_state_t *ctl) |
| |
- Author
- Anustuv Pal anust.nosp@m.uv@i.nosp@m.cl.ut.nosp@m.k.ed.nosp@m.u (updated in 2023, redesigned with multi-threading support.)
-
Tony Castaldo tonyc.nosp@m.asta.nosp@m.ldo@i.nosp@m.cl.u.nosp@m.tk.ed.nosp@m.u (updated in 08/2019, to make counters accumulate.)
-
Tony Castaldo tonyc.nosp@m.asta.nosp@m.ldo@i.nosp@m.cl.u.nosp@m.tk.ed.nosp@m.u (updated in 2018, to use batch reads and support nvlink metrics.
-
Asim YarKhan yarkh.nosp@m.an@i.nosp@m.cl.ut.nosp@m.k.ed.nosp@m.u (updated in 2017 to support CUDA metrics)
-
Asim YarKhan yarkh.nosp@m.an@i.nosp@m.cl.ut.nosp@m.k.ed.nosp@m.u (updated in 2015 for multiple CUDA contexts/devices)
-
Heike Jagode (First version, in collaboration with Robert Dietrich, TU Dresden) jagod.nosp@m.e@ic.nosp@m.l.utk.nosp@m..edu
The open source software license for PAPI conforms to the BSD License template.
Definition in file linux-cuda.c.
◆ PAPI_CUDA_MAX_COUNTERS
| #define PAPI_CUDA_MAX_COUNTERS 30 |
◆ PAPI_CUDA_MPX_COUNTERS
| #define PAPI_CUDA_MPX_COUNTERS 512 |
◆ check_n_initialize()
| static int check_n_initialize |
( |
void |
| ) |
|
|
static |
Definition at line 170 of file linux-cuda.c.
171{
176 ) {
178 }
179
181 return papi_errno;
182}
papi_vector_t _cuda_vector
static int cuda_init_private(void)
PAPI_component_info_t cmp_info
inline_static int _papi_hwi_lock(int lck)
inline_static int _papi_hwi_unlock(int lck)
◆ cuda_cleanup_eventset()
Definition at line 360 of file linux-cuda.c.
361{
367 }
370 }
373 }
375}
int cuptid_control_destroy(cuptid_ctl_t *pcupti_ctl)
int cuptid_thread_info_destroy(cuptid_info_t *info)
#define COMPDBG(format, args...)
◆ cuda_init_component()
| static int cuda_init_component |
( |
int |
cidx | ) |
|
|
static |
Definition at line 114 of file linux-cuda.c.
115{
116 COMPDBG(
"Entering with component idx: %d\n",
cidx);
117
121
125 "Not initialized. Access component events to initialize it.");
127}
char disabled_reason[PAPI_HUGE_STR_LEN]
◆ cuda_init_control_state() [1/2]
◆ cuda_init_control_state() [2/2]
◆ cuda_init_private()
| static int cuda_init_private |
( |
void |
| ) |
|
|
static |
Definition at line 144 of file linux-cuda.c.
145{
147 const char *disabled_reason;
149
152 goto fn_exit;
153 }
154
160 goto fn_exit;
161 }
162
165
166fn_exit:
167 return papi_errno;
168}
int cuptid_event_table_create(ntv_event_table_t *evt_table)
void cuptid_disabled_reason_get(const char **msg)
ntv_event_table_t global_event_names
◆ cuda_init_thread() [1/2]
◆ cuda_init_thread() [2/2]
◆ cuda_ntv_code_to_descr() [1/2]
Definition at line 259 of file linux-cuda.c.
260{
262 int papi_errno;
265 goto fn_exit;
266 }
267
272 goto fn_exit;
273 }
274
277 goto fn_exit;
278 }
280fn_exit:
281 return papi_errno;
282}
int cuptid_event_enum(cuptiu_event_table_t *all_evt_names)
int cuptid_event_name_to_descr(char *evt_name, char *descr)
char * evt_name(evstock *stock, int index)
#define PAPI_2MAX_STR_LEN
static int check_n_initialize(void)
static int cuda_ntv_code_to_name(unsigned int event_code, char *name, int len)
◆ cuda_ntv_code_to_descr() [2/2]
| static int cuda_ntv_code_to_descr |
( |
unsigned int |
event_code, |
|
|
char * |
descr, |
|
|
int |
len |
|
) |
| |
|
static |
◆ cuda_ntv_code_to_name()
| static int cuda_ntv_code_to_name |
( |
unsigned int |
event_code, |
|
|
char * |
name, |
|
|
int |
len |
|
) |
| |
|
static |
Definition at line 244 of file linux-cuda.c.
245{
248 return papi_errno;
249 }
254 }
257}
int cuptid_event_table_get_item(ntv_event_table_t evt_table, unsigned int evt_idx, ntv_event_t *record)
◆ cuda_ntv_enum_events()
| static int cuda_ntv_enum_events |
( |
unsigned int * |
event_code, |
|
|
int |
modifier |
|
) |
| |
|
static |
Definition at line 184 of file linux-cuda.c.
185{
188 goto fn_exit;
189 }
190
192 LOCKDBG(
"Locked COMPONENT_LOCK to enumerate all events.\n");
195 LOCKDBG(
"Unlocked COMPONENT_LOCK.\n");
197 goto fn_exit;
198 }
199
201 switch (modifier) {
203 *event_code = 0;
205 break;
209 }
else if (*event_code < global_event_names->
count - 1) {
210 *event_code = *event_code + 1;
212 } else {
214 }
215 break;
216 default:
218 }
219fn_exit:
220 return papi_errno;
221}
#define LOCKDBG(format, args...)
◆ cuda_ntv_name_to_code()
| static int cuda_ntv_name_to_code |
( |
const char * |
name, |
|
|
unsigned int * |
event_code |
|
) |
| |
|
static |
Definition at line 223 of file linux-cuda.c.
224{
227 goto fn_exit;
228 }
232 *event_code = evt_rec->evt_code;
233 }
234 else {
239 }
240fn_exit:
241 return papi_errno;
242}
int cuptid_event_table_insert_record(ntv_event_table_t evt_table, const char *evt_name, unsigned int evt_code, int evt_pos)
int cuptid_event_table_find_name(ntv_event_table_t evt_table, const char *evt_name, ntv_event_t *found_rec)
◆ cuda_read() [1/2]
◆ cuda_read() [2/2]
Definition at line 417 of file linux-cuda.c.
418{
421 int papi_errno;
422
425 goto fn_exit;
426 }
428
429fn_exit:
430 return papi_errno;
431}
int cuptid_control_read(cuptid_ctl_t cupti_ctl, long long *values)
long long values[PAPI_CUDA_MAX_COUNTERS]
◆ cuda_reset() [1/2]
◆ cuda_reset() [2/2]
Definition at line 433 of file linux-cuda.c.
434{
439 }
441}
int cuptid_control_reset(cuptid_ctl_t cupti_ctl)
◆ cuda_set_domain() [1/2]
◆ cuda_set_domain() [2/2]
◆ cuda_shutdown_component()
| static int cuda_shutdown_component |
( |
void |
| ) |
|
|
static |
Definition at line 129 of file linux-cuda.c.
130{
133
137 }
138
140
142}
void cuptid_event_table_destroy(ntv_event_table_t *evt_table)
int cuptid_shutdown(void)
◆ cuda_shutdown_thread() [1/2]
◆ cuda_shutdown_thread() [2/2]
◆ cuda_start() [1/2]
◆ cuda_start() [2/2]
Definition at line 377 of file linux-cuda.c.
378{
381
385 }
389 goto fn_exit;
390 }
393 goto fn_exit;
394 }
395
397
398fn_exit:
400 return papi_errno;
401}
int cuptid_control_create(ntv_event_table_t event_names, cuptid_info_t info, cuptid_ctl_t *pcupti_ctl)
int cuptid_control_start(cuptid_ctl_t cupti_ctl)
int cuptid_event_table_select_by_idx(ntv_event_table_t evt_table, int count, int *idcs, ntv_event_table_t *pevt_names)
int events_id[PAPI_CUDA_MAX_COUNTERS]
◆ cuda_stop() [1/2]
◆ cuda_stop() [2/2]
Definition at line 403 of file linux-cuda.c.
404{
407 int papi_errno;
410 goto fn_exit;
411 }
413fn_exit:
414 return papi_errno;
415}
int cuptid_control_stop(cuptid_ctl_t cupti_ctl)
◆ cuda_update_control_state() [1/2]
Definition at line 309 of file linux-cuda.c.
312 {
313 COMPDBG(
"Entering with events_count %d.\n", ntv_count);
317 return papi_errno;
318 }
319 if (ntv_count == 0) {
321 }
322
324 if (control->
info == NULL) {
327 goto fn_exit;
328 }
329 }
331
333 ERRDBG(
"Too many events added.\n");
335 goto fn_exit;
336 }
337 for (
i=0;
i<ntv_count;
i++) {
340 }
341
342 void *tmp_context = NULL;
346 goto fn_exit;
347 }
351 goto fn_exit;
352 }
354
355fn_exit:
357 return papi_errno;
358}
int cuptid_thread_info_create(cuptid_info_t *info)
#define ERRDBG(format, args...)
#define PAPI_CUDA_MAX_COUNTERS
◆ cuda_update_control_state() [2/2]
◆ _cuda_vector
◆ global_event_names