Skip to main content

A Python module to access the function of the LIKWID library

Project description

pylikwid

Python interface for the C API of LIKWID (https://github.com/RRZE-HPC/likwid)

https://travis-ci.org/RRZE-HPC/pylikwid.svg?branch=master

Installation

I added a setup.py script for the installation. It builds the C module and copies it to the proper destination.

$ tar -xjf likwid-python-api.tar.bz2
$ cd likwid-python-api
# Build C interface
$ python setup.py build_ext -I <include path for likwid> -L <library path for likwid> -R <library path for likwid>
# Install module to the proper location
$ python setup.py install (--prefix=<where to install>)
# Testing
$ python -c "import pylikwid"
$ ./testlib.py

Functions

After import pylikwid you can call the following functions:

Marker API

  • pylikwid.init(): Initialize the Marker API of the LIKWID library. Must be called previous to all other functions.

  • pylikwid.threadinit(): Add the current thread to the Marker API. Since Python is commonly single-threaded simply call it directly after pylikwid.init()

  • rr = pylikwid.registerregion(regiontag): Register a region to the Marker API. This is an optional function to reduce the overhead of region registration at pylikwid.startregion. If you don’t call pylikwid.registerregion(regiontag), the registration is done at pylikwid.startregion(regiontag). On success, 0 is return. If you havn’t called pylikwid.init(), a negative number is returned.

  • err = pylikwid.startregion(regiontag): Start measurements under the name regiontag. On success, 0 is return. If you havn’t called pylikwid.init(), a negative number is returned.

  • err = pylikwid.stopregion(regiontag): Stop measurements under the name regiontag again. On success, 0 is return. If you havn’t called pylikwid.init(), a negative number is returned.

  • num_events, events[], time, count = pylikwid.getregion(regiontag): Get the intermediate results of the region identified by regiontag. On success, it returns the number of events in the current group, a list with all the aggregated event results, the measurement time for the region and the number of calls.

  • pylikwid.nextgroup(): Switch to the next event set in a round-robin fashion. If you have set only one event set on the command line, this function performs no operation.

  • pylikwid.close(): Close the connection to the LIKWID Marker API and write out measurement data to file. This file will be evaluated by likwid-perfctr.

  • pylikwid.getprocessorid(): Returns the ID of the currently executing CPU

  • pylikwid.pinprocess(cpuid): Pins the current process to the CPU given as cpuid.

  • pylikwid.pinthread(cpuid): Pins the current thread to the CPU given as cpuid.

Topology

  • pylikwid.inittopology(): Initialize the topology module (reads in system topology)

  • infodict = pylikwid.getcpuinfo(): Return a dict with general information about the system (CPU model, CPU family, …)

    • osname: Name of the CPU retrieved from the CPUID leafs

    • name: Name of the micro architecture

    • short_name: Short name of the micro architectur

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylikwid-0.2.tar.gz (9.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page