The Performance Application Programming Interface (PAPI) supplies a consistent interface and methodology for collecting performance counter information from various hardware and software components, including most major CPUs, GPUs, accelerators, interconnects, I/O systems, and power interfaces, as well as virtual cloud environments.
cyPAPI
provides a convenient interface for Python programs to access PAPI profiling features with minimum overhead. It supports PAPI version >= 7.0.0.0
Currently cyPAPI
supports installation from source. From the source root execute make install
.
- Cython
- C compiler
- PAPI library installed
- First checks if user has set
PAPI_PATH
environment variable pointing to the location of PAPI installation - Then it checks if pkg-config utility can locate PAPI installation
- Then it relies on
C_INCLUDE_PATHS
&LIBRARY_PATHS
to be used by compiler - It also looks for papi library in
LD_LIBRARY_PATH
- Lastly it expects that PAPI is installed in default OS installation paths
- First checks if user has set
from cypapi import *
PyPAPI_library_init()
eventset = PyPAPI_EventSet()
eventset.add_named_event('PAPI_TOT_CYC')
eventset.add_named_event('PAPI_TOT_INS')
eventset.start()
# Do some computation
values = eventset.stop()
print(values)