Skip to main content

pyCubexR is a Python package for reading the Cube4 file format.

Project description

pyCubexR

PyPI - Python Version GitHub release (latest by date) PyPI version PyPI - License GitHub issues GitHub pull requests GitHub Workflow Status

pyCubexR is a Python package for reading the Cube4 (.cubex) file format. Cube is used as a performance report explorer for Scalasca and Score-P. It is used as a generic tool for displaying a multidimensional performance space consisting of the dimensions (i) performance metric, (ii) call path, and (iii) system resource. Each dimension can be represented as a tree, where non-leaf nodes of the tree can be collapsed or expanded to achieve the desired level of granularity. The Cube4 (.cubex) data format is provided for Cube files produced with the Score-P performance instrumentation and measurement infrastructure or the Scalasca version 2.x trace analyzer (and other compatible tools).

For additional information about the supported features of the Cube4 file format, see the Cube file format documentation. The report contains general information about Cube, pyCubexR, and other related tools.

For questions regarding pyCubexR please send a message to extra-p-support@lists.parallel.informatik.tu-darmstadt.de.

Installation

To install the current release, which includes support for Ubuntu and Windows:

$ pip install pycubexr

To update pyCubexR to the latest version, add --upgrade flag to the above commands.

Usage

The following code provides a minimal example that shows how pyCubexR can be used to read all metrics, callpaths, and measurement values of a .cubex file:

from pycubexr import CubexParser

cubex_file_path = "some/profile.cubex"
with CubexParser(cubex_file_path) as cubex:
    # iterate over all metrics in cubex file
    for metric in cubex.get_metrics():
        metric_values = cubex.get_metric_values(metric=metric)

        # return the name of the current metric
        metric_name = metric.name

        # iterate over all callpaths in cubex file
        for cnode_id in metric_values.cnode_indices:
            cnode = cubex.get_cnode(cnode_id)

            # return the current region i.e. callpath
            region = cubex.get_region(cnode)

            # return the name of the current region
            region_name = region.name

            # return the measurement values for all mpi processes for the current metric and callpath
            cnode_values = metric_values.cnode_values(cnode)

Not all .cubex files must contain measurement values for all metrics for each callpath. This is especially true for MPI functions such as MPI_Waitall. In some cases, metrics can be missing. Use the MissingMetricError to deal with these exceptions.

from pycubexr import CubexParser
from pycubexr.utils.exceptions import MissingMetricError

cubex_file_path = "some/profile.cubex"
with CubexParser(cubex_file_path) as cubex:
    for metric in cubex.get_metrics():

        try:
            metric_values = cubex.get_metric_values(metric=metric)

            for cnode_id in metric_values.cnode_indices:
                cnode = cubex.get_cnode(cnode_id)

                # return only a specific number of measurement values for the current metric and callpath
                cnode_values = metric_values.cnode_values(cnode)[:5]

                region = cubex.get_region(cnode)

                # print the data read from the file
                print('\t' + '-' * 100)
                print(f'\tRegion: {region.name}\n\tMetric: {metric.name}\n\tMetricValues: {cnode_values})')

        except MissingMetricError as e:
            # Ignore missing metrics
            pass

The call tree of a .cubex file can be displayed with the following code:

from pycubexr import CubexParser

cubex_file_path = "some/profile.cubex"
with CubexParser(cubex_file_path) as cubex:
    # print the call tree of the .cubex file
    cubex.print_calltree() 

In special cases, it is also possible that a .cubex file is missing measurement values for some of the callpaths of a metric or that a .cubex file of the same application contains fewer callpaths than another file. These cases need to be handled externally and are not supported by pyCubexR.

License

BSD 3-Clause "New" or "Revised" License

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

pycubexr-2.1.1.tar.gz (76.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pycubexr-2.1.1-py3-none-any.whl (22.3 kB view details)

Uploaded Python 3

File details

Details for the file pycubexr-2.1.1.tar.gz.

File metadata

  • Download URL: pycubexr-2.1.1.tar.gz
  • Upload date:
  • Size: 76.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pycubexr-2.1.1.tar.gz
Algorithm Hash digest
SHA256 124031f86ed313c5c58048a16e8661324e644fea025795509516bd55df0e709a
MD5 a7bc38893a87db428c21a38ed4201e74
BLAKE2b-256 ba829afcf426654f6b14831fb4e2064288468271e89a6b8e333d64302bc8697a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycubexr-2.1.1.tar.gz:

Publisher: python-publish.yml on extra-p/pycubexr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pycubexr-2.1.1-py3-none-any.whl.

File metadata

  • Download URL: pycubexr-2.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pycubexr-2.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 da8eccc8f1039946f78fde53cfa4b5fc7fe50fc1dc194e0de4905576687ecd48
MD5 b01101c7ef6b6b34e8388331e54f1ce2
BLAKE2b-256 9120fd7fc99f08d5995f5ada41e51bbbc09093b72d2536de9db36a6bd584be71

See more details on using hashes here.

Provenance

The following attestation bundles were made for pycubexr-2.1.1-py3-none-any.whl:

Publisher: python-publish.yml on extra-p/pycubexr

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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