pynscq


Namepynscq JSON
Version 2.0.1 PyPI version JSON
download
home_page
SummaryPython bindings for the NVSwitch Configuration and Query (NSCQ) library
upload_time2023-01-30 17:33:42
maintainer
docs_urlNone
authorNVIDIA Corporation
requires_python>=3
license
keywords nvidia nvswitch nscq management nvlink
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PyNSCQ
======

Python bindings to the NSCQ library (NVSwitch Configuration & Query library)
------------------------------------------------

Provides a Python interface to NVSwitch querying.

This is a wrapper around the NSCQ library.

Download the latest package from:
http://pypi.python.org/pypi/pynscq/

Note this file can be run with 'python -m doctest -v README.md'
although the results are system dependent

REQUIRES
--------
Python 3.0

INSTALLATION
------------

Pip Installation with python3:
- `python3 -m pip install nvidia-pynscq`

USAGE
-----
```
>>>#!/usr/bin/env python
>>>
>>>from pynscq.paths import nscq_nvswitch_device_uuid_path
>>>from pynscq import *
>>>
>>>devices = []
>>>
>>>@nscqCallback(p_nscq_uuid_t, nscq_rc_t, p_nscq_uuid_t, user_data_type)
>>>def device_uuid_callback(device, rc, uuid, _user_data):
...    label = nscq_uuid_to_label(uuid.contents)
...    devices.append(label.data.decode("UTF-8"))
>>>
>>>
>>>with NSCQSession() as session:
...    session.path_observe(nscq_nvswitch_device_uuid_path, device_uuid_callback)
>>>
>>>for label in devices:
...    print(label)
```

FUNCTIONS
---------
Python methods wrap NSCQ functions, implemented in a C shared library.
Each function's use is the same with the following exceptions:

- Instead of returning error codes, failing error codes are raised as Python exceptions.

```
>>> try:
...    session.path_observe(nscq_nvswitch_device_uuid_path, device_uuid_callback)
... except NSCQError as error:
...     print(error)
...
Uninitialized
```

- C structs are converted into Python classes.

```
>>>// C query struct
>>>typedef struct {
...    uint8_t bytes[16];
>>>} nscq_uuid_t;

# Python call to function and accessing members of ctype struct
>>>class nscq_uuid_t(_PrintableStructure):
...    _fields_ = [("bytes", ctypes.c_uint8 * 16)]
...
...    def __str__(self):
...        return "[%s]" % (", ".join(hex(x) for x in self.bytes))
...
...    __repr__ = __str__
```

VARIABLES
---------
All meaningful NSCQ constants and enums are exposed in Python.

RELEASE NOTES
-------------
v2.0.1 - Initial Release

COPYRIGHT
---------
Copyright (c) 2020-2023, NVIDIA Corporation.  All rights reserved.

LICENSE
-------
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 NVIDIA Corporation 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.



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pynscq",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": "",
    "keywords": "nvidia nvswitch nscq management nvlink",
    "author": "NVIDIA Corporation",
    "author_email": "CUDAIssues@nvidia.com",
    "download_url": "https://files.pythonhosted.org/packages/b2/2c/61126c485823559c589eb12890c9d90c8bb63d583c4a60c6496c15878933/pynscq-2.0.1.tar.gz",
    "platform": null,
    "description": "PyNSCQ\n======\n\nPython bindings to the NSCQ library (NVSwitch Configuration & Query library)\n------------------------------------------------\n\nProvides a Python interface to NVSwitch querying.\n\nThis is a wrapper around the NSCQ library.\n\nDownload the latest package from:\nhttp://pypi.python.org/pypi/pynscq/\n\nNote this file can be run with 'python -m doctest -v README.md'\nalthough the results are system dependent\n\nREQUIRES\n--------\nPython 3.0\n\nINSTALLATION\n------------\n\nPip Installation with python3:\n- `python3 -m pip install nvidia-pynscq`\n\nUSAGE\n-----\n```\n>>>#!/usr/bin/env python\n>>>\n>>>from pynscq.paths import nscq_nvswitch_device_uuid_path\n>>>from pynscq import *\n>>>\n>>>devices = []\n>>>\n>>>@nscqCallback(p_nscq_uuid_t, nscq_rc_t, p_nscq_uuid_t, user_data_type)\n>>>def device_uuid_callback(device, rc, uuid, _user_data):\n...    label = nscq_uuid_to_label(uuid.contents)\n...    devices.append(label.data.decode(\"UTF-8\"))\n>>>\n>>>\n>>>with NSCQSession() as session:\n...    session.path_observe(nscq_nvswitch_device_uuid_path, device_uuid_callback)\n>>>\n>>>for label in devices:\n...    print(label)\n```\n\nFUNCTIONS\n---------\nPython methods wrap NSCQ functions, implemented in a C shared library.\nEach function's use is the same with the following exceptions:\n\n- Instead of returning error codes, failing error codes are raised as Python exceptions.\n\n```\n>>> try:\n...    session.path_observe(nscq_nvswitch_device_uuid_path, device_uuid_callback)\n... except NSCQError as error:\n...     print(error)\n...\nUninitialized\n```\n\n- C structs are converted into Python classes.\n\n```\n>>>// C query struct\n>>>typedef struct {\n...    uint8_t bytes[16];\n>>>} nscq_uuid_t;\n\n# Python call to function and accessing members of ctype struct\n>>>class nscq_uuid_t(_PrintableStructure):\n...    _fields_ = [(\"bytes\", ctypes.c_uint8 * 16)]\n...\n...    def __str__(self):\n...        return \"[%s]\" % (\", \".join(hex(x) for x in self.bytes))\n...\n...    __repr__ = __str__\n```\n\nVARIABLES\n---------\nAll meaningful NSCQ constants and enums are exposed in Python.\n\nRELEASE NOTES\n-------------\nv2.0.1 - Initial Release\n\nCOPYRIGHT\n---------\nCopyright (c) 2020-2023, NVIDIA Corporation.  All rights reserved.\n\nLICENSE\n-------\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n- 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.\n\n- Neither the name of the NVIDIA Corporation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\nTHIS 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.\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Python bindings for the NVSwitch Configuration and Query (NSCQ) library",
    "version": "2.0.1",
    "split_keywords": [
        "nvidia",
        "nvswitch",
        "nscq",
        "management",
        "nvlink"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "552908b5153483cf275b8ef642cebe173ed7991f979e40c50468fb9d8a3d6deb",
                "md5": "601d077451f0d3e98ede2a9a878a9d15",
                "sha256": "037661935d7dd2d0234ba4935a8c411d0645a58b6dba7f35d55492a9b466582c"
            },
            "downloads": -1,
            "filename": "pynscq-2.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "601d077451f0d3e98ede2a9a878a9d15",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3",
            "size": 18006,
            "upload_time": "2023-01-30T17:33:41",
            "upload_time_iso_8601": "2023-01-30T17:33:41.153936Z",
            "url": "https://files.pythonhosted.org/packages/55/29/08b5153483cf275b8ef642cebe173ed7991f979e40c50468fb9d8a3d6deb/pynscq-2.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b22c61126c485823559c589eb12890c9d90c8bb63d583c4a60c6496c15878933",
                "md5": "455c48d0cc5259bbfd2072f86a626420",
                "sha256": "3421752f02c9fdb46d63d6e0276af2b12b32ea71eb1678292ea6528672999243"
            },
            "downloads": -1,
            "filename": "pynscq-2.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "455c48d0cc5259bbfd2072f86a626420",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 13898,
            "upload_time": "2023-01-30T17:33:42",
            "upload_time_iso_8601": "2023-01-30T17:33:42.780946Z",
            "url": "https://files.pythonhosted.org/packages/b2/2c/61126c485823559c589eb12890c9d90c8bb63d583c4a60c6496c15878933/pynscq-2.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-30 17:33:42",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pynscq"
}
        
Elapsed time: 0.03755s