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/16 13:51] – sh | doku:papi [2016/06/16 14:01] – sh | ||
---|---|---|---|
Line 91: | Line 91: | ||
or similarly for Fortran users, | or similarly for Fortran users, | ||
- | include ' | + | include ' |
- | | + | |
- | | + | |
+ | |||
+ | 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 | ||
+ | endif | ||
- | check = PAPI_NULL | ||
- | C | ||
- | C PAPI Initialization | ||
- | 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 | ||
- | endif | ||
- | C | ||
- | C PAPI Event Set Creation | ||
- | C | ||
- | | ||
- | call PAPIF_create_eventset(evntst, | ||
- | if (check.ne.PAPI_OK) then | ||
- | write(6,*) 'PAPI event set creation error' | ||
- | write(6,*) '01 check:', | ||
- | stop | ||
- | endif | ||
- | C | ||
- | C PAPI Specify a Particular Target Event to Analyze | ||
- | C PAPI_TOT_CYC | ||
- | C PAPI_FP_OPS | ||
- | C PAPI_L1_DCM | ||
- | C PAPI_L2_DCM | ||
- | C for other events see / | ||
- | C | ||
- | call PAPIF_add_event(evntst, | ||
- | if (check.ne.PAPI_OK) then | ||
- | write(6,*) 'PAPI event set adding error' | ||
- | write(6,*) '02 check:', | ||
- | stop | ||
- | endif | ||
- | C | ||
- | C PAPI Time Estimators Initialization | ||
- | C | ||
- | call PAPIF_get_real_usec(t0) | ||
- | call PAPIF_get_real_cyc(c0) | ||
- | C | ||
- | C PAPI Counting Start | ||
- | C | ||
- | call PAPIF_start(evntst, | ||
- | if (check.ne.PAPI_OK) then | ||
- | write(6,*) 'PAPI start error !' | ||
- | write(6,*) '03 check:', | ||
- | stop | ||
- | endif | ||
- | |||
- | C | ||
- | C *** Here follows the original code section to be analyzed *** | ||
- | C | ||
- | |||
- | C | ||
- | C PAPI Counting Stop | ||
- | C | ||
- | call PAPIF_stop(evntst, | ||
- | if (check.ne.PAPI_OK) then | ||
- | write(6,*) 'PAPI stop error !' | ||
- | write(6,*) '04 check:', | ||
- | stop | ||
- | endif | ||
- | C | ||
- | C PAPI Time Estimators Stop | ||
- | C | ||
- | call PAPIF_get_real_usec(t1) | ||
- | call PAPIF_get_real_cyc(c1) | ||
- | C | ||
- | C PAPI Results | ||
- | C | ||
- | | ||
- | | ||
- | | ||
- | C | ||
- | C PAPI Free Event Set | ||
- | C | ||
- | call PAPIF_cleanup_eventset(evntst, | ||
- | if (check.ne.PAPI_OK) then | ||
- | write(6,*) 'PAPI event set cleanup error !' | ||
- | write(6,*) '05 check:', | ||
- | stop | ||
- | endif | ||
- | call PAPIF_destroy_eventset(evntst, | ||
- | if (check.ne.PAPI_OK) then | ||
- | write(6,*) 'PAPI event set destruction error !' | ||
- | write(6,*) '06 check:', | ||
- | stop | ||
- | endif | ||
- | C | ||
- | C PAPI Finalize | ||
- | C | ||
- | call PAPIF_shutdown(check) | ||
- | if (check.ne.PAPI_OK) then | ||
- | write(6,*) 'PAPI finalize failed !' | ||
- | write(6,*) '07 check:', | ||
- | stop | ||
- | endif | ||
- | |||
- | |||
- | # | ||
- | // PAPI variables | ||
- | // best is to analyze one particular event at a time | ||
+ | |||
==== Practical tips: ==== | ==== Practical tips: ==== | ||
* A quick overview of supported events and corresponding '' | * A quick overview of supported events and corresponding '' |