#pragma offload target(mic: target_idx) if(offload_mode) in(argc, argv) inout(TESTS_QUIET)
253{
259 int enum_modifier;
260 int numcmp, cid;
261
262 int num_devices = 0;
263 int target_idx = 0;
264 int offload_mode = 0;
265 int target_ok = 0;
266
267
269
271 {
272 printf("Checking for Intel(R) Xeon Phi(TM) (Target CPU) devices...\n\n");
273
274#ifdef __INTEL_OFFLOAD
275 num_devices = _Offload_number_of_devices();
276#endif
277 printf("Number of Target devices installed: %d\n\n",num_devices);
278
279 if (flags.
devidx >= num_devices) {
280
281 printf("Requested device index %d is not available. Specify a device between 0 and %d\n\n",
282 flags.
devidx, num_devices-1);
283 exit(1);
284 }
285 else {
286 offload_mode = 1;
287 target_idx = flags.
devidx;
288 printf("PAPI will list the native events available on device mic%d\n\n", target_idx);
289 }
290 }
291
292
295 else if ( flags.
darr )
297 else if ( flags.
iear )
299 else if ( flags.
iarr )
301 else if ( flags.
opcm )
303 else
305
307
308
309#ifdef __INTEL_OFFLOAD
310 __Offload_report(1);
311#endif
312 #pragma offload target(mic: target_idx) if(offload_mode)
313
316 fprintf(
stderr,
"Error! PAPI_library_init\n");
318 }
319
320
322#ifdef __INTEL_OFFLOAD
323 __Offload_report(1);
324#endif
325 #pragma offload target(mic: target_idx) if(offload_mode)
328 fprintf(
stderr,
"Error! PAPI_set_debug\n");
330 }
331 }
332
333#ifdef __INTEL_OFFLOAD
334 __Offload_report(1);
335#endif
336 #pragma offload target(mic: target_idx) if(offload_mode) nocopy(hwinfo)
337 {
340 }
342 fprintf(
stderr,
"Error! PAPI_get_hardware_info\n");
343 exit( 2 );
344 }
345
346
347
349 {
350 int papi_ok = 0;
351 char *ename = flags.
name;
352 int elen = 0;
353 if (ename)
354 elen = strlen(ename) + 1;
355#ifdef __INTEL_OFFLOAD
356 __Offload_report(1);
357#endif
358 #pragma offload target(mic: target_idx) if(offload_mode) in(ename:length(elen)) out(i)
360
362 {
363#ifdef __INTEL_OFFLOAD
364 __Offload_report(1);
365#endif
366 #pragma offload target(mic: target_idx) if(offload_mode) out(info)
368 }
369
371 {
372 printf( "%-30s%s\n",
373 "Event name:", info.
symbol);
374 printf(
"%-29s|%s|\n",
"Description:", info.
long_descr );
375
376
377 if ( !strchr( flags.
name,
':' ) )
378 {
379#ifdef __INTEL_OFFLOAD
380 __Offload_report(1);
381#endif
382 #pragma offload target(mic: target_idx) if(offload_mode) inout(i)
385 {
386 printf( "\nUnit Masks:\n" );
387 do
388 {
389#ifdef __INTEL_OFFLOAD
390 __Offload_report(1);
391#endif
392 #pragma offload target(mic: target_idx) if(offload_mode) inout(i, info)
396 printf( "%-29s|%s|%s|\n", " Mask Info:",
398 }
399 }
400#ifdef __INTEL_OFFLOAD
401 __Offload_report(1);
402#endif
403 #pragma offload target(mic: target_idx) if(offload_mode) inout(i, info)
406 }
407 }
408 } else {
409 printf("Sorry, an event by the name '%s' could not be found.\n",
411 printf("Is it typed correctly?\n\n");
412 exit( 1 );
413 }
414 }
415 else {
416
417
418
419#ifdef __INTEL_OFFLOAD
420 __Offload_report(1);
421#endif
422 #pragma offload target(mic: target_idx) if(offload_mode)
424
425 j = 0;
426
427 for ( cid = 0; cid < numcmp; cid++ ) {
428
430
431
432
433#ifdef __INTEL_OFFLOAD
434 __Offload_report(1);
435#endif
436 #pragma offload target(mic: target_idx) if(offload_mode) out(component)
437 {
439 }
440
441
443
444 printf( "===============================================================================\n" );
445 printf(
" Native Events in Component: %s\n",component.
name);
446 printf( "===============================================================================\n" );
447
448
449
451
452#ifdef __INTEL_OFFLOAD
453 __Offload_report(1);
454#endif
455 #pragma offload target(mic: target_idx) if(offload_mode) inout(i)
457
458 do
459 {
460 memset( &info, 0, sizeof ( info ) );
461#ifdef __INTEL_OFFLOAD
462 __Offload_report(1);
463#endif
464 #pragma offload target(mic: target_idx) if(offload_mode) inout(info)
466
467
469 goto endloop;
470
471
474 goto endloop;
475 }
476 }
477
478
481 goto endloop;
482 }
483
484
485 j++;
486
488
490 if (info.
units[0]) printf(
"| Units: %-67s|\n",
492 }
493
494
495
496
497
498
499
500
502 int papi_ok = 0;
504#ifdef __INTEL_OFFLOAD
505 __Offload_report(1);
506#endif
507 #pragma offload target(mic: target_idx) if(offload_mode) inout(k)
510 {
511 printf("Groups: ");
512 do {
515#ifdef __INTEL_OFFLOAD
516 __Offload_report(1);
517#endif
518 #pragma offload target(mic: target_idx) if(offload_mode) inout(k)
521 printf( "\n" );
522 }
523 }
524
525
526
527
529 {
530 int papi_ok = 0;
532#ifdef __INTEL_OFFLOAD
533 __Offload_report(1);
534#endif
535 #pragma offload target(mic: target_idx) if(offload_mode) inout(k)
538 {
539 do {
540#ifdef __INTEL_OFFLOAD
541 __Offload_report(1);
542#endif
543 #pragma offload target(mic: target_idx) if(offload_mode) inout(info)
548 }
549#ifdef __INTEL_OFFLOAD
550 __Offload_report(1);
551#endif
552 #pragma offload target(mic: target_idx) if(offload_mode) inout(k)
555 }
556 }
557 printf( "--------------------------------------------------------------------------------\n" );
558
559endloop:
560#ifdef __INTEL_OFFLOAD
561 __Offload_report(1);
562#endif
563 #pragma offload target(mic: target_idx) if(offload_mode) inout(i)
566 }
567
568 printf("\n");
569 printf( "Total events reported: %d\n", j );
570 }
571
572 return 0;
573}
Enumerate PAPI preset or native events for a given component.
Enumerate PAPI preset or native events.
Convert a name to a numeric hardware event code.
get information about a specific software component
Get the event's name and description info.
initialize the PAPI library.
Get the number of components available on the system.
Set the current debug level for error output from PAPI.
#define PAPI_NTV_GROUP_AND_MASK
#define PAPI_NTV_ENUM_IEAR
#define PAPI_NTV_ENUM_UMASKS
#define PAPI_NTV_ENUM_OPCM
#define PAPI_NTV_GROUP_SHIFT
#define PAPI_NTV_ENUM_DEAR
#define PAPI_NTV_ENUM_DARR
#define PAPI_NTV_ENUM_IARR
static int parse_unit_masks(PAPI_event_info_t *info)
static void parse_args(int argc, char **argv, command_flags_t *f)
static void print_event(PAPI_event_info_t *info, int offset)
char name[PAPI_MAX_STR_LEN]
char units[PAPI_MIN_STR_LEN]
char symbol[PAPI_HUGE_STR_LEN]
char long_descr[PAPI_HUGE_STR_LEN]