Skip to content

Commit

Permalink
Merge pull request #37 from SerodioJ/v6.0.0.1
Browse files Browse the repository at this point in the history
feat!: Updated PAPI library to v6.0.0.1

BREAKING CHANGE: various API change in PAPI library from the 5.x versions
  • Loading branch information
flozz authored Mar 7, 2024
2 parents f780773 + 537df3e commit a096fd4
Show file tree
Hide file tree
Showing 18 changed files with 4,256 additions and 2,339 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "papi"]
path = papi
url = https://bitbucket.org/icl/papi.git
url = https://github.com/icl-utk-edu/papi.git
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ubuntu:20.04 as build_stage

RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
python3 \
python3-pip \
libffi-dev \
&& \
rm -rf /var/lib/apt/lists/*



WORKDIR /pypapi

COPY papi papi

WORKDIR /pypapi/papi/src

ENV CFLAGS="-fPIC -Werror=format-truncation=0"
ENV PAPI_COMPONENTS="net powercap rapl"
RUN ./configure --with-components="${PAPI_COMPONENTS}" && \
make

WORKDIR /pypapi

RUN pip install cffi==1.16.0

COPY setup.py setup.py

COPY pypapi pypapi

RUN python3 pypapi/papi_build.py

RUN pip install .
3,917 changes: 2,057 additions & 1,860 deletions MANIFEST.in

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@
# built documents.
#
# The short X.Y version.
version = u'5.5.1'
version = u'6.0.0'
# The full version, including alpha/beta/rc tags.
release = u'5.5.1.1'
release = u'6.0.0.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
86 changes: 86 additions & 0 deletions docs/consts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,92 @@ PAPI State Constants
.. autodata:: pypapi.consts.PAPI_CPU_ATTACHED


.. _consts_mask:

PAPI Mask Constants
--------------------

.. autodata:: pypapi.consts.PAPI_NATIVE_MASK
.. autodata:: pypapi.consts.PAPI_PRESET_MASK


.. _consts_option:

PAPI Option Constants
---------------------

.. autodata:: pypapi.consts.PAPI_MIN_STR_LEN
.. autodata:: pypapi.consts.PAPI_MAX_STR_LEN
.. autodata:: pypapi.consts.PAPI_2MAX_STR_LEN
.. autodata:: pypapi.consts.PAPI_HUGE_STR_LEN
.. autodata:: pypapi.consts.PAPI_MAX_INFO_TERMS


.. _consts_error:

PAPI Error Constants
--------------------

.. autodata:: pypapi.consts.PAPI_QUIET
.. autodata:: pypapi.consts.PAPI_VERB_ECONT
.. autodata:: pypapi.consts.PAPI_VERB_ESTOP


.. _consts_domain:

PAPI Domain Constants
---------------------

.. autodata:: pypapi.consts.PAPI_DOM_USER
.. autodata:: pypapi.consts.PAPI_DOM_MIN
.. autodata:: pypapi.consts.PAPI_DOM_KERNEL
.. autodata:: pypapi.consts.PAPI_DOM_OTHER
.. autodata:: pypapi.consts.PAPI_DOM_SUPERVISOR
.. autodata:: pypapi.consts.PAPI_DOM_ALL
.. autodata:: pypapi.consts.PAPI_DOM_MAX
.. autodata:: pypapi.consts.PAPI_DOM_HWSPEC


.. _consts_granularity:

PAPI Granularity Constants
--------------------------

.. autodata:: pypapi.consts.PAPI_GRN_THR
.. autodata:: pypapi.consts.PAPI_GRN_MIN
.. autodata:: pypapi.consts.PAPI_GRN_PROC
.. autodata:: pypapi.consts.PAPI_GRN_PROCG
.. autodata:: pypapi.consts.PAPI_GRN_SYS
.. autodata:: pypapi.consts.PAPI_GRN_SYS_CPU
.. autodata:: pypapi.consts.PAPI_GRN_MAX


.. _consts_locking:

PAPI Locking Mechanisms Constants
---------------------------------


.. autodata:: pypapi.consts.PAPI_USR1_LOCK
.. autodata:: pypapi.consts.PAPI_USR2_LOCK
.. autodata:: pypapi.consts.PAPI_NUM_LOCK
.. autodata:: pypapi.consts.PAPI_LOCK_USR1
.. autodata:: pypapi.consts.PAPI_LOCK_USR2
.. autodata:: pypapi.consts.PAPI_LOCK_NUM

.. _consts_flops:

PAPI FLIPS/FLOPS Constants
--------------------------

.. autodata:: pypapi.consts.PAPI_FP_INS
.. autodata:: pypapi.consts.PAPI_VEC_SP
.. autodata:: pypapi.consts.PAPI_VEC_DP
.. autodata:: pypapi.consts.PAPI_FP_OPS
.. autodata:: pypapi.consts.PAPI_SP_OPS
.. autodata:: pypapi.consts.PAPI_DP_OPS


Other PAPI Constants
--------------------

Expand Down
40 changes: 29 additions & 11 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,38 @@ Example usage:

::

# High Level API

from pypapi import papi_high
from pypapi import events as papi_events

# Starts some counters
papi_high.start_counters([
papi_events.PAPI_FP_OPS,
papi_events.PAPI_TOT_CYC
])
papi_high.hl_region_begin("computation")

# computation

papi_high.hl_region_end("computation")


::

# Low Level API

from pypapi import papi_low as papi
from pypapi import events

papi.library_init()

evs = papi.create_eventset()
papi.add_event(evs, events.PAPI_FP_OPS)

papi.start(evs)

# Do some computation here

# Reads values from counters and reset them
results = papi_high.read_counters() # -> [int, int]
result = papi.stop(evs)
print(result)

# Reads values from counters and stop them
results = papi_high.stop_counters() # -> [int, int]
papi.cleanup_eventset(evs)
papi.destroy_eventset(evs)


.. toctree::
Expand All @@ -33,7 +51,7 @@ Example usage:
install
papi_high
papi_low
types
structs
events
consts
exceptions
Expand Down
5 changes: 2 additions & 3 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ As PAPI is a C library, it must be compiled. On Ubuntu / Debian, you can
install the ``build-essential`` package.


From PYPI
From PyPI
---------

To install PyPAPI from PYPI, simply use pip::
Expand Down Expand Up @@ -33,6 +33,5 @@ Finally, execute the following command::
.. note::

you may require root permission if you want to install the package
system-wild.

system-wide.

5 changes: 5 additions & 0 deletions docs/structs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PAPI Structs
============

.. automodule:: pypapi.structs
:members:
5 changes: 0 additions & 5 deletions docs/types.rst

This file was deleted.

2 changes: 1 addition & 1 deletion papi
Submodule papi updated 946 files
2 changes: 2 additions & 0 deletions pypapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
from . import events
from . import consts
from . import exceptions
from . import structs

__all__ = [
"papi_high",
"papi_low",
"events",
"consts",
"exceptions",
"structs",
]
Loading

0 comments on commit a096fd4

Please sign in to comment.