# pyrsmi
### Python Bindings for System Management Library for AMD GPUs
--------
- `pyrsmi` is a python package of rocm-smi-lib, for providing a limited features of ROCm System Management Library for assisting Python development involving AMD GPUs.
- It is based on (`rocm-smi-lib`)[https://github.com/RadeonOpenCompute/rocm_smi_lib], so its scope of support should be similar to that of the latter.
## Requirements
- `pyrsmi` runs on latest ROCm-supported Instinct MI-series GPU systems. Scope of tested systems is limited; please create tickets for any issues encountered.
## How to install from source
- Clone this repo:
- `git clone https://github.com/AMD-AI/pyrsmi.git`
- cd pyrsmi
- `python -m pip install -e .`
- `pyrsmi` can be installed as PyPA-compatible Python package.
## How to install Python packages
- Install `build` package:
- `pip install build`
- At the top directory (where setup.py is), run: `python -m build`
- Then by default packages (both sdist and wheel) will be built under `dist` directory.
- The packages can be either installed with `pip install`, or be uploaded to PyPI (release or test) repo, or an artifactory of your choice. The latter can be installed liked beflow.
## How to install from PyPI
- **NOTE:** Until the package becomes available at the official PyPI repo, the package is available from **test PyPI** site:
- `python -m pip install --index-url https://test.pypi.org/simple pyrsmi`
- When the release version become available at pypi.org site, the package can be installed with :
- `python -m pip install pyrsmi`
## How to use `pyrsmi`
- In python:
```python
from pyrsmi import rocml
rocml.smi_initialize()
print(rocml.smi_get_device_count())
rocml.smi_shutdown()
```
## Examples
- Examples directory contains a number of code snippets showing how to use the package.
- It also contains an example showing how to use pyrsmi to create a web-based system monitoring tool that displays various dashboards of system status, including memory, CPU/GPU utilization and process names.
## List of API functions
| Function | Description | Argument | Return Type | Note |
| -------- | ----------- | ------- | ---------- | ---- |
| smi_initialize | initialize rsmi | None | None | |
| smi_shutdown | shut down rsmi | None | None | |
| smi_get_version | get version of rsmi | None | str | 'major.minor.patch' |
| smi_get_kernel_version | get version of ROCm kernel driver | None | str | |
| smi_get_device_count | get number of GPU devices | None | int | num of devices |
| smi_get_device_name | get name of GPU devices | None | str | |
| smi_get_device_unique_id | get unique id of GPU devices | None | int | 64bit integer |
| smi_get_device_utilization | get device utilization in % busy | device_id | int | |
| smi_get_device_memory_used | get device memory usage | device_id | int | in Bytes, type 'VRAM' |
| smi_get_device_memory_total | get device's total memory | device_id | int | in Bytes, type 'VRAM' |
| smi_get_device_pcie_bandwidth | get device's estimated PCIe bandwidth | device_id | float | in Bytes/sec |
| smi_get_device_compute_process | get list of pid of processes running on dev | device_id | List[int] | |
| smi_get_device_average_power | get device's average power | device_id | float | power in Watt |
Raw data
{
"_id": null,
"home_page": "http://www.amd.com",
"name": "pyrsmi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "rocm,smi,amd,system management",
"author": "AMD Author",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/a0/57/2a07d57d6c4efdc47bd42c4497f3d93470000afb3f6c94637a50b2f1e99c/pyrsmi-1.0.1.tar.gz",
"platform": null,
"description": "# pyrsmi\n### Python Bindings for System Management Library for AMD GPUs\n--------\n- `pyrsmi` is a python package of rocm-smi-lib, for providing a limited features of ROCm System Management Library for assisting Python development involving AMD GPUs.\n- It is based on (`rocm-smi-lib`)[https://github.com/RadeonOpenCompute/rocm_smi_lib], so its scope of support should be similar to that of the latter.\n\n## Requirements\n- `pyrsmi` runs on latest ROCm-supported Instinct MI-series GPU systems. Scope of tested systems is limited; please create tickets for any issues encountered.\n\n## How to install from source\n- Clone this repo: \n - `git clone https://github.com/AMD-AI/pyrsmi.git`\n - cd pyrsmi\n- `python -m pip install -e .`\n- `pyrsmi` can be installed as PyPA-compatible Python package.\n\n## How to install Python packages\n- Install `build` package:\n - `pip install build`\n- At the top directory (where setup.py is), run: `python -m build`\n- Then by default packages (both sdist and wheel) will be built under `dist` directory.\n- The packages can be either installed with `pip install`, or be uploaded to PyPI (release or test) repo, or an artifactory of your choice. The latter can be installed liked beflow.\n\n## How to install from PyPI\n- **NOTE:** Until the package becomes available at the official PyPI repo, the package is available from **test PyPI** site:\n- `python -m pip install --index-url https://test.pypi.org/simple pyrsmi`\n- When the release version become available at pypi.org site, the package can be installed with :\n - `python -m pip install pyrsmi`\n\n## How to use `pyrsmi`\n- In python:\n```python\nfrom pyrsmi import rocml\n\nrocml.smi_initialize()\nprint(rocml.smi_get_device_count())\nrocml.smi_shutdown()\n```\n\n## Examples\n- Examples directory contains a number of code snippets showing how to use the package.\n- It also contains an example showing how to use pyrsmi to create a web-based system monitoring tool that displays various dashboards of system status, including memory, CPU/GPU utilization and process names. \n\n## List of API functions\n\n| Function | Description | Argument | Return Type | Note |\n| -------- | ----------- | ------- | ---------- | ---- |\n| smi_initialize | initialize rsmi | None | None | |\n| smi_shutdown | shut down rsmi | None | None | |\n| smi_get_version | get version of rsmi | None | str | 'major.minor.patch' |\n| smi_get_kernel_version | get version of ROCm kernel driver | None | str | |\n| smi_get_device_count | get number of GPU devices | None | int | num of devices |\n| smi_get_device_name | get name of GPU devices | None | str | |\n| smi_get_device_unique_id | get unique id of GPU devices | None | int | 64bit integer |\n| smi_get_device_utilization | get device utilization in % busy | device_id | int | |\n| smi_get_device_memory_used | get device memory usage | device_id | int | in Bytes, type 'VRAM' |\n| smi_get_device_memory_total | get device's total memory | device_id | int | in Bytes, type 'VRAM' |\n| smi_get_device_pcie_bandwidth | get device's estimated PCIe bandwidth | device_id | float | in Bytes/sec |\n| smi_get_device_compute_process | get list of pid of processes running on dev | device_id | List[int] | |\n| smi_get_device_average_power | get device's average power | device_id | float | power in Watt |\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python Bindings for System Management Library for AMD GPUs",
"version": "1.0.1",
"project_urls": {
"Homepage": "http://www.amd.com"
},
"split_keywords": [
"rocm",
"smi",
"amd",
"system management"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "621cf08a2c4bdda8e59abb3be32d546197911cdb0c3a96c290c59a8316b11349",
"md5": "73850f7c1f9d751d12cc9e622b665fbe",
"sha256": "c5c91e0964cdaf22636616025c1669b1df14ee0c84d599c426ee5d1067ea94e8"
},
"downloads": -1,
"filename": "pyrsmi-1.0.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "73850f7c1f9d751d12cc9e622b665fbe",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.6",
"size": 8460,
"upload_time": "2023-09-25T20:09:24",
"upload_time_iso_8601": "2023-09-25T20:09:24.667638Z",
"url": "https://files.pythonhosted.org/packages/62/1c/f08a2c4bdda8e59abb3be32d546197911cdb0c3a96c290c59a8316b11349/pyrsmi-1.0.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a0572a07d57d6c4efdc47bd42c4497f3d93470000afb3f6c94637a50b2f1e99c",
"md5": "4da6a06022e67dc84ac0ebd2cf185209",
"sha256": "39993b3fb6b1bdff993cac3b86b03a10677b50efce9926fbabdb631e153f5774"
},
"downloads": -1,
"filename": "pyrsmi-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "4da6a06022e67dc84ac0ebd2cf185209",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 9572,
"upload_time": "2023-09-25T20:09:26",
"upload_time_iso_8601": "2023-09-25T20:09:26.586696Z",
"url": "https://files.pythonhosted.org/packages/a0/57/2a07d57d6c4efdc47bd42c4497f3d93470000afb3f6c94637a50b2f1e99c/pyrsmi-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-25 20:09:26",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pyrsmi"
}