PAPI High Level API
This module binds PAPI High Level API.
Example using the High Level API:
from pypapi import papi_high
papi_high.hl_region_begin("computation")
# computation
papi_high.hl_region_end("computation")
To change where results are stored or which events to record is achieved with environment variables.
Bash:
export PAPI_EVENTS="PAPI_TOT_INS,PAPI_TOT_CYC"
export PAPI_OUTPUT_DIRECTORY="path/to/output"
Python:
import os
os.environ["PAPI_EVENTS"] = "PAPI_TOT_INS,PAPI_TOT_CYC"
os.environ["PAPI_OUTPUT_DIRECTORY"] = "path/to/output"
- pypapi.papi_high.hl_read(region)
Read performance events inside of a region and store the difference to the corresponding beginning of the region.
- Parameters:
region (string) – name of instrumented region
- Returns:
Operation status
- Return type:
int
- Raises:
PapiInvalidValueError – One or more of the arguments is invalid.
PapiSystemError – A system or C library call failed inside PAPI.
- pypapi.papi_high.hl_region_begin(region)
Read performance events at the beginning of a region.
- Parameters:
region (string) – name of instrumented region
- Returns:
Operation status
- Return type:
int
- Raises:
PapiInvalidValueError – One or more of the arguments is invalid.
PapiSystemError – A system or C library call failed inside PAPI.
- pypapi.papi_high.hl_region_end(region)
Read performance events at the end of a region and store the difference to the corresponding beginning of the region.
- Parameters:
region (string) – name of instrumented region
- Returns:
Operation status
- Return type:
int
- Raises:
PapiInvalidValueError – One or more of the arguments is invalid.
PapiSystemError – A system or C library call failed inside PAPI.
- pypapi.papi_high.hl_stop()
Stops a running high-level event set.
- Returns:
Operation status
- Return type:
int
- Raises:
PapiInvalidValueError – One or more of the arguments is invalid.
PapiSystemError – A system or C library call failed inside PAPI.