What is PAPI?
PAPI aims to provide the tool designer and application engineer with a consistent interface and methodology for use of the performance counter hardware found in most major microprocessors. PAPI enables software engineers to see, in near real time, the relation between software performance and processor events.
PAPI is developed under the auspices of Innovative Computing Laboratory (ICL).
PAPI installations at LRZ
PAPI is presently available on SuperMUC and on all cluster systems run under the SLURM batch environment.
Before using PAPI, you should load an appropriate environment module:
module load papi
PAPI requires user instrumentation of the program; to this end include files and PAPI function calls must be inserted in the subroutines which are to be measured.
- For C, please include the file papi.h
- For Fortran 77, please include the file f77papi.h
- For Fortran 90, please include the file f90papi.h
- If you intend to preprocess your Fortran code, you may use the file fpapi.h
Then, build the objects with
[icc|ifort] <your_compiler_options> $PAPI_INC -o mysub.o [mysub.f|mysub.f90|mysub.c]
and then link them using
[icc|ifort] <your_linkage_options> -o myprog.exe mysub.o ... $PAPI_LIB
Running code with PAPI from a script
The monitoring system running on every node will carry out measurements every 10 minutes. It is therefore important to switch it off from your job script. Before running your code, you should use the command:
srun sh -c 'if [ $SLURM_LOCALID == 0 ]; then /lrz/sys/tools/dcdb/bin/perfstop.sh; fi'
List the contents of $PAPI_BASE/bin and consult the corresponding man pages for details.
The following documentation (outdated, please consult the PAPI docs for up-to-date information) can be downloaded from the LRZ web server:
- PAPI User's Guide
- PAPI Programmer's Reference
- PAPI Conversion Cookbook for those who still use PAPI V2 instrumentation
- PAPI Design Document and Specification