About this Install Guide

This guide is intended to get you up and running with this tool quickly with the most common settings. For a thorough review of all options, refer to the official documentation.

Performance Application Programming Interface (PAPI) provides a consistent library of functions for accessing performance counters from an application.

You can use PAPI in your source code to access performance counters and profile specific sections of your application.

PAPI is available as source code on GitHub.

Before you begin

This article provides concise instructions to download, build, and install PAPI on Arm Linux distributions.

Confirm you are using an Arm machine by running:

    

        
        
            uname -m
        
    

The output should be:

    

        
        aarch64

        
    

If you see a different result, you are not using an Arm computer running 64-bit Linux.

You need gcc and make to build PAPI.

Use the Linux package manager to install the required software packages on your Linux distribution.

For Debian based distributions (including Ubuntu) run:

    

        
        
            sudo apt update -y
sudo apt install -y make gcc
        
    

Download, build, install, and test PAPI

  1. Clone the PAPI repository:
    

        
        
            git clone https://github.com/icl-utk-edu/papi/
cd papi/src
        
    
  1. Configure and compile the source code:
    

        
        
            ./configure && make
        
    
  1. Configure and compile the source code:
    

        
        
            sudo make install
        
    
  1. Copy the test program below and paste it into a text file named `papi-test.c``:
    

        
        
            #include <papi.h>
#include <stdio.h>
#include <stdlib.h>

int main()
{
    // Initialize the PAPI library and print the version
    int ver = PAPI_library_init(PAPI_VER_CURRENT);
    printf("PAPI version is %d.%d\n", PAPI_VERSION_MAJOR(ver), PAPI_VERSION_MINOR(ver));

    exit(0);
}
        
    
  1. Compile and run the application:
    

        
        
            gcc -o papi-test papi-test.c -Wl,-rpath /usr/local/lib  -lpapi
./papi-test
        
    

The output will be similar to:

    

        
        PAPI version is 7.0

        
    

Your version may be slightly different but that is fine.

You are now ready to use PAPI in your own applications.


Feedback

How would you rate the overall quality of this tool quick-install guide?