caliper-reader


Namecaliper-reader JSON
Version 0.4.1 PyPI version JSON
download
home_pageNone
SummaryA Python library for reading Caliper .cali files
upload_time2024-10-29 19:57:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseCopyright (c) 2015-2021, Lawrence Livermore National Security, LLC. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            caliper-reader: A Python reader for Caliper files
=================================================

This Python package reads the native .cali files produced by the
[Caliper](https://github.com/LLNL/Caliper) performance profiling
library.

You can install caliper-reader with pip:

    $ pip install caliper-reader

Alternatively, add the `python/caliper-reader` path in the cloned
Caliper repository to `PYTHONPATH`.

Usage
---------------------------------------

The `CaliperReader` class reads a Caliper file and then provides its
contents in the `records` and `globals` class members, where `records`
is a Python list-of-dicts containing the recorded performance data
and `globals` is a Python dict with program metadata about the run.
The dicts represent Caliper attribute:value records: the key is the
Caliper attribute name; the value is a string or list of strings.
The example below prints the `avg#inclusive#sum#time.duration` metric
for every region path in the provided example profile data file:

```Python
import caliperreader as cr

r = cr.CaliperReader()
r.read('example-profile.cali')

metric = 'avg#inclusive#sum#time.duration'

for rec in r.records:
    path = rec['path'] if 'path' in rec else 'UNKNOWN'
    time = rec[metric] if metric in rec else '0'

    if (isinstance(path, list)):
        path = "/".join(path)

    print("{0}: {1}".format(path, time))
```

The CaliperReader `attributes()` function returns the list of Caliper
attributes. The `attribute()` function returns an `Attribute` object
to query metadata for a given Caliper attribute name:

```Python
>>> a = r.attribute('avg#inclusive#sum#time.duration')
>>> a.get('attribute.unit')
'sec'
```

You can use the `read_caliper_contents` function as a shortcut to read
Caliper data without creating a `CaliperReader` object:

```Python
(records,globals) = cr.read_caliper_contents('example-profile.cali')
```

Use `read_caliper_globals` if you only need the global (metadata) record:

```Python
globals = cr.read_caliper_globals('example-profile.cali')
```

Authors
---------------------------------------

Caliper was created by [David Boehme](https://github.com/daboehme), boehme3@llnl.gov.

Release
-------------------------------------

Caliper is released under a BSD 3-clause license.
See [LICENSE](LICENSE) for details.

``LLNL-CODE-678900``

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "caliper-reader",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "David Boehme <boehme3@llnl.gov>",
    "download_url": "https://files.pythonhosted.org/packages/65/9f/cd17de6baed6a2c6b17af5f9719c591808d56ff42dd4c1e48886899f27fc/caliper_reader-0.4.1.tar.gz",
    "platform": null,
    "description": "caliper-reader: A Python reader for Caliper files\n=================================================\n\nThis Python package reads the native .cali files produced by the\n[Caliper](https://github.com/LLNL/Caliper) performance profiling\nlibrary.\n\nYou can install caliper-reader with pip:\n\n    $ pip install caliper-reader\n\nAlternatively, add the `python/caliper-reader` path in the cloned\nCaliper repository to `PYTHONPATH`.\n\nUsage\n---------------------------------------\n\nThe `CaliperReader` class reads a Caliper file and then provides its\ncontents in the `records` and `globals` class members, where `records`\nis a Python list-of-dicts containing the recorded performance data\nand `globals` is a Python dict with program metadata about the run.\nThe dicts represent Caliper attribute:value records: the key is the\nCaliper attribute name; the value is a string or list of strings.\nThe example below prints the `avg#inclusive#sum#time.duration` metric\nfor every region path in the provided example profile data file:\n\n```Python\nimport caliperreader as cr\n\nr = cr.CaliperReader()\nr.read('example-profile.cali')\n\nmetric = 'avg#inclusive#sum#time.duration'\n\nfor rec in r.records:\n    path = rec['path'] if 'path' in rec else 'UNKNOWN'\n    time = rec[metric] if metric in rec else '0'\n\n    if (isinstance(path, list)):\n        path = \"/\".join(path)\n\n    print(\"{0}: {1}\".format(path, time))\n```\n\nThe CaliperReader `attributes()` function returns the list of Caliper\nattributes. The `attribute()` function returns an `Attribute` object\nto query metadata for a given Caliper attribute name:\n\n```Python\n>>> a = r.attribute('avg#inclusive#sum#time.duration')\n>>> a.get('attribute.unit')\n'sec'\n```\n\nYou can use the `read_caliper_contents` function as a shortcut to read\nCaliper data without creating a `CaliperReader` object:\n\n```Python\n(records,globals) = cr.read_caliper_contents('example-profile.cali')\n```\n\nUse `read_caliper_globals` if you only need the global (metadata) record:\n\n```Python\nglobals = cr.read_caliper_globals('example-profile.cali')\n```\n\nAuthors\n---------------------------------------\n\nCaliper was created by [David Boehme](https://github.com/daboehme), boehme3@llnl.gov.\n\nRelease\n-------------------------------------\n\nCaliper is released under a BSD 3-clause license.\nSee [LICENSE](LICENSE) for details.\n\n``LLNL-CODE-678900``\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2015-2021, Lawrence Livermore National Security, LLC. All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:  * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.  * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.  * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ",
    "summary": "A Python library for reading Caliper .cali files",
    "version": "0.4.1",
    "project_urls": {
        "Homepage": "https://github.com/LLNL/Caliper"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e8eadbda42eca5a31831797d1f9405c3a0fff2ceccb4c1ead530c36086b94cf2",
                "md5": "cc44d2a54e57dd1797580b010e76e279",
                "sha256": "a667c95e8705a6879d69d21a587d736b694a30c55d60ac1a8cacd41ec8b80fc6"
            },
            "downloads": -1,
            "filename": "caliper_reader-0.4.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cc44d2a54e57dd1797580b010e76e279",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 10367,
            "upload_time": "2024-10-29T19:57:28",
            "upload_time_iso_8601": "2024-10-29T19:57:28.553831Z",
            "url": "https://files.pythonhosted.org/packages/e8/ea/dbda42eca5a31831797d1f9405c3a0fff2ceccb4c1ead530c36086b94cf2/caliper_reader-0.4.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "659fcd17de6baed6a2c6b17af5f9719c591808d56ff42dd4c1e48886899f27fc",
                "md5": "6335049decd9c82feb72908c62426573",
                "sha256": "8864faf06650420374f38060c5a5f1c8c7d48f0617d9029708d7743b78b50d41"
            },
            "downloads": -1,
            "filename": "caliper_reader-0.4.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6335049decd9c82feb72908c62426573",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8240,
            "upload_time": "2024-10-29T19:57:29",
            "upload_time_iso_8601": "2024-10-29T19:57:29.913662Z",
            "url": "https://files.pythonhosted.org/packages/65/9f/cd17de6baed6a2c6b17af5f9719c591808d56ff42dd4c1e48886899f27fc/caliper_reader-0.4.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-29 19:57:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LLNL",
    "github_project": "Caliper",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "caliper-reader"
}
        
Elapsed time: 7.85249s