Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
doku:papi [2016/06/15 11:46] – sh | doku:papi [2016/06/16 13:54] – sh | ||
---|---|---|---|
Line 8: | Line 8: | ||
==== Usage of papi: ==== | ==== Usage of papi: ==== | ||
- | The user will have to modify the source code and insert '' | + | The user will have to modify the source code and insert '' |
- | |||
| | ||
| | ||
- | gcc my_program.c -lpapi | + | gcc my_program.c -lpapi |
| | ||
+ | or for Fortran users, | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
==== Interfacing with papi : ==== | ==== Interfacing with papi : ==== | ||
Line 48: | Line 54: | ||
exit(995); | exit(995); | ||
} | } | ||
- | // PAPI Time Estimators | + | // PAPI Time Estimators |
time0 = PAPI_get_real_usec(); | time0 = PAPI_get_real_usec(); | ||
cyc0 = PAPI_get_real_cyc(); | cyc0 = PAPI_get_real_cyc(); | ||
Line 76: | Line 82: | ||
exit(998); | exit(998); | ||
} | } | ||
- | if (PAPI_destroy_eventset(& | + | if (PAPI_destroy_eventset(& |
printf(" | printf(" | ||
exit(999); | exit(999); | ||
Line 83: | Line 89: | ||
| | ||
- | + | or similarly for Fortran users, | |
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | check = PAPI_NULL | ||
+ | C | ||
+ | | ||
+ | C | ||
+ | check = PAPI_VER_CURRENT | ||
+ | call PAPIF_library_init(check) | ||
+ | if (check.ne.PAPI_VER_CURRENT) then | ||
+ | write(6,*) 'PAPI init error' | ||
+ | write(6,*) '00 check:', | ||
+ | stop | ||
+ | | ||
+ | C | ||
+ | | ||
+ | C | ||
+ | | ||
+ | call PAPIF_create_eventset(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | write(6,*) 'PAPI event set creation error' | ||
+ | write(6,*) '01 check:', | ||
+ | stop | ||
+ | | ||
+ | C | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | C | ||
+ | call PAPIF_add_event(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | write(6,*) 'PAPI event set adding error' | ||
+ | write(6,*) '02 check:', | ||
+ | stop | ||
+ | | ||
+ | C | ||
+ | | ||
+ | | ||
+ | call PAPIF_get_real_usec(t0) | ||
+ | call PAPIF_get_real_cyc(c0) | ||
+ | C | ||
+ | | ||
+ | | ||
+ | call PAPIF_start(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | write(6,*) 'PAPI start error !' | ||
+ | write(6,*) '03 check:', | ||
+ | stop | ||
+ | | ||
+ | |||
+ | C | ||
+ | | ||
+ | C | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | call PAPIF_stop(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | write(6,*) 'PAPI stop error !' | ||
+ | write(6,*) '04 check:', | ||
+ | stop | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | call PAPIF_get_real_usec(t1) | ||
+ | call PAPIF_get_real_cyc(c1) | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | call PAPIF_cleanup_eventset(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | write(6,*) 'PAPI event set cleanup error !' | ||
+ | write(6,*) '05 check:', | ||
+ | stop | ||
+ | | ||
+ | call PAPIF_destroy_eventset(evntst, | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | write(6,*) 'PAPI event set destruction error !' | ||
+ | write(6,*) '06 check:', | ||
+ | stop | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | call PAPIF_shutdown(check) | ||
+ | if (check.ne.PAPI_OK) then | ||
+ | write(6,*) 'PAPI finalize failed !' | ||
+ | write(6,*) '07 check:', | ||
+ | stop | ||
+ | | ||
+ | |||
==== Practical tips: ==== | ==== Practical tips: ==== | ||
* A quick overview of supported events and corresponding '' | * A quick overview of supported events and corresponding '' | ||
* Measuring the specific event '' | * Measuring the specific event '' | ||
* Evaluating floating point performance on Intel ivy bridge: [[https:// | * Evaluating floating point performance on Intel ivy bridge: [[https:// | ||
- | * Occasionally it is useful to '' | + | |
+ | | ||
- | Operation modes may be distinguished between: | ||
- | === A.) papi enclosing long lasting code sections: === | ||
- | === B.) papi around hotspot functions/ | ||