device-smi


Namedevice-smi JSON
Version 0.3.2 PyPI version JSON
download
home_pagehttps://github.com/ModelCloud/Device-SMI/
SummaryRetrieve gpu, cpu, and npu device info and properties from Linux/MacOS with zero package dependency.
upload_time2024-12-05 13:24:29
maintainerNone
docs_urlNone
authorModelCloud
requires_python>=3
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Device-SMI

Self-contained Python lib with zero-dependencies that give you a unified `device` properties for `gpu`, `cpu`, and `npu`. No more calling separate tools such as `nvidia-smi` or `/proc/cpuinfo` and parsing it yourself.

<p align="center">
    <a href="https://github.com/ModelCloud/Device-SMI/releases" style="text-decoration:none;"><img alt="GitHub release" src="https://img.shields.io/github/release/ModelCloud/Device-SMI.svg"></a>
    <a href="https://pypi.org/project/device-smi/" style="text-decoration:none;"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/device-smi"></a>
    <a href="https://pepy.tech/projects/device-smi" style="text-decoration:none;"><img src="https://static.pepy.tech/badge/device-smi" alt="PyPI Downloads"></a>
    <a href="https://github.com/ModelCloud/Device-SMI/blob/main/LICENSE"><img src="https://img.shields.io/pypi/l/device-smi" alt="License"></a>
    <a href="https://huggingface.co/modelcloud/"><img src="https://img.shields.io/badge/🤗%20Hugging%20Face-ModelCloud-%23ff8811.svg"></a>
</p>

## News
* 12/05/2024 [0.3.2](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.3.2) Added Windows `WSL` support.
* 12/03/2024 [0.3.1](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.3.1) Added `CPUDevice` compat for Windows.
* 12/02/2024 [0.3.0](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.3.0) Added `OSDevice`.[`name`, `version`, `kernel`, `arch`] for Linux/MacOS/Windows/FreeBSD/Solaris. Added `cpu.`[`count`, `cores`, `threads`] properties. Bug fix for gpu device index. 
* 11/29/2024 [0.2.1](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.2.1) Added `pcie.`[`gen`, `speed`, `id`] + [`firmware`, `driver`] properties to `GPU` device.

## Features

- Retrieve information for both CPU and GPU devices.
- Includes details about memory usage, utilization, driver, pcie info when applicable, and other device specifications.
- Zero pypi dependency.
- Linux/MacOS support

Supported Devices:

- **OS**: Linux, MacOS, Windows, FreeBSD, Solaris
- **CPU**: [Intel/AMD/Apple] Linux/MacOS system interface
- **NVIDIA GPU**: NVIDIA System Management Interface `nvidia-smi`
- **Intel XPU**: Intel/XPU System Management Interface `xpu-smi`
- **Apple GPU**: MacOS interfaces

## Usage

For OS, use `os` to init a new Device object.

```py
from device_smi import Device

dev = Device("os")
print(dev)
```

Output: (Ubuntu 22.04)

> {'type': 'os', 'name': 'ubuntu', 'version': '22.04', 'kernel': '6.12.1-x64v3-xanmod2', 'arch': 'x86_64'}

For GPU/XPU, use [`gpu`, `cuda`] for Nvidia and `xpu` for Intel/XPU. Index usage for multiple GPUs: `cuda:0`

```py
from device_smi import Device

dev = Device("cuda:0")
print(dev)
```

Output: (Nvidia 4090)

> {'pcie': {'gen': 2, 'speed': 1, 'id': '00000000:16:00.0'}, 'gpu': {'driver': '565.57.01', 'firmware': '95.02.3C.40.E7'}, 'type': 'gpu', 'model': 'geforce rtx 4090', 'memory_total': 25757220864, 'vendor': 'nvidia', 'features': ['8.9']}

For CPU, use `cpu` to init a new Device object. 

```py
from device_smi import Device

dev = Device("cpu")
print(dev)
```

Output: (AMD EPYC 7443)

> {'type': 'cpu', 'model': 'epyc 7443', 'vendor': 'amd', 'memory_total': 1000000000000, 'count': 2, 'cores': 48, 'threads': 96, 'features': ['3dnowprefetch', 'abm', 'adx', 'aes', 'amd_ppin', 'aperfmperf', 'apic', 'arat', 'avx', 'avx2', 'bmi1', 'bmi2', 'bpext', 'brs', 'cat_l3', 'cdp_l3', 'clflush', 'clflushopt', 'clwb', 'clzero', 'cmov', 'cmp_legacy', 'constant_tsc', 'cpb', 'cpuid', 'cqm', 'cqm_llc', 'cqm_mbm_local', 'cqm_mbm_total', 'cqm_occup_llc', 'cr8_legacy', 'cx16', 'cx8', 'de', 'debug_swap', 'decodeassists', 'erms', 'extapic', 'extd_apicid', 'f16c', 'flushbyasid', 'fma', 'fpu', 'fsgsbase', 'fsrm', 'fxsr', 'fxsr_opt', 'ht', 'hw_pstate', 'ibpb', 'ibrs', 'ibs', 'invpcid', 'irperf', 'lahf_lm', 'lbrv', 'lm', 'mba', 'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'monitor', 'movbe', 'msr', 'mtrr', 'mwaitx', 'nonstop_tsc', 'nopl', 'npt', 'nrip_save', 'nx', 'ospke', 'osvw', 'overflow_recov', 'pae', 'pat', 'pausefilter', 'pcid', 'pclmulqdq', 'pdpe1gb', 'perfctr_core', 'perfctr_llc', 'perfctr_nb', 'pfthreshold', 'pge', 'pku', 'pni', 'popcnt', 'pse', 'pse36', 'rapl', 'rdpid', 'rdpru', 'rdrand', 'rdseed', 'rdt_a', 'rdtscp', 'rep_good', 'sep', 'sha_ni', 'skinit', 'smap', 'smca', 'smep', 'ssbd', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'stibp', 'succor', 'svm', 'svm_lock', 'syscall', 'tce', 'topoext', 'tsc', 'tsc_scale', 'umip', 'user_shstk', 'v_spec_ctrl', 'v_vmsave_vmload', 'vaes', 'vgif', 'vmcb_clean', 'vme', 'vmmcall', 'vpclmulqdq', 'wbnoinvd', 'wdt', 'xgetbv1', 'xsave', 'xsavec', 'xsaveerptr', 'xsaveopt', 'xsaves', 'xtopology']}


## Roadmap

- Support AMD GPU
- Support Intel/Gaudi
- Support Google/TPU
- Add NPU support (ARM/Intel/AMD)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ModelCloud/Device-SMI/",
    "name": "device-smi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3",
    "maintainer_email": null,
    "keywords": null,
    "author": "ModelCloud",
    "author_email": "qubitium@modelcloud.ai",
    "download_url": "https://files.pythonhosted.org/packages/a1/3f/b022e88cdde986378c39322dbe1f13d0aa0c1056c548154d802a2a7a14c6/device_smi-0.3.2.tar.gz",
    "platform": null,
    "description": "# Device-SMI\n\nSelf-contained Python lib with zero-dependencies that give you a unified `device` properties for `gpu`, `cpu`, and `npu`. No more calling separate tools such as `nvidia-smi` or `/proc/cpuinfo` and parsing it yourself.\n\n<p align=\"center\">\n    <a href=\"https://github.com/ModelCloud/Device-SMI/releases\" style=\"text-decoration:none;\"><img alt=\"GitHub release\" src=\"https://img.shields.io/github/release/ModelCloud/Device-SMI.svg\"></a>\n    <a href=\"https://pypi.org/project/device-smi/\" style=\"text-decoration:none;\"><img alt=\"PyPI - Version\" src=\"https://img.shields.io/pypi/v/device-smi\"></a>\n    <a href=\"https://pepy.tech/projects/device-smi\" style=\"text-decoration:none;\"><img src=\"https://static.pepy.tech/badge/device-smi\" alt=\"PyPI Downloads\"></a>\n    <a href=\"https://github.com/ModelCloud/Device-SMI/blob/main/LICENSE\"><img src=\"https://img.shields.io/pypi/l/device-smi\" alt=\"License\"></a>\n    <a href=\"https://huggingface.co/modelcloud/\"><img src=\"https://img.shields.io/badge/\ud83e\udd17%20Hugging%20Face-ModelCloud-%23ff8811.svg\"></a>\n</p>\n\n## News\n* 12/05/2024 [0.3.2](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.3.2) Added Windows `WSL` support.\n* 12/03/2024 [0.3.1](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.3.1) Added `CPUDevice` compat for Windows.\n* 12/02/2024 [0.3.0](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.3.0) Added `OSDevice`.[`name`, `version`, `kernel`, `arch`] for Linux/MacOS/Windows/FreeBSD/Solaris. Added `cpu.`[`count`, `cores`, `threads`] properties. Bug fix for gpu device index. \n* 11/29/2024 [0.2.1](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.2.1) Added `pcie.`[`gen`, `speed`, `id`] + [`firmware`, `driver`] properties to `GPU` device.\n\n## Features\n\n- Retrieve information for both CPU and GPU devices.\n- Includes details about memory usage, utilization, driver, pcie info when applicable, and other device specifications.\n- Zero pypi dependency.\n- Linux/MacOS support\n\nSupported Devices:\n\n- **OS**: Linux, MacOS, Windows, FreeBSD, Solaris\n- **CPU**: [Intel/AMD/Apple] Linux/MacOS system interface\n- **NVIDIA GPU**: NVIDIA System Management Interface `nvidia-smi`\n- **Intel XPU**: Intel/XPU System Management Interface `xpu-smi`\n- **Apple GPU**: MacOS interfaces\n\n## Usage\n\nFor OS, use `os` to init a new Device object.\n\n```py\nfrom device_smi import Device\n\ndev = Device(\"os\")\nprint(dev)\n```\n\nOutput: (Ubuntu 22.04)\n\n> {'type': 'os', 'name': 'ubuntu', 'version': '22.04', 'kernel': '6.12.1-x64v3-xanmod2', 'arch': 'x86_64'}\n\nFor GPU/XPU, use [`gpu`, `cuda`] for Nvidia and `xpu` for Intel/XPU. Index usage for multiple GPUs: `cuda:0`\n\n```py\nfrom device_smi import Device\n\ndev = Device(\"cuda:0\")\nprint(dev)\n```\n\nOutput: (Nvidia 4090)\n\n> {'pcie': {'gen': 2, 'speed': 1, 'id': '00000000:16:00.0'}, 'gpu': {'driver': '565.57.01', 'firmware': '95.02.3C.40.E7'}, 'type': 'gpu', 'model': 'geforce rtx 4090', 'memory_total': 25757220864, 'vendor': 'nvidia', 'features': ['8.9']}\n\nFor CPU, use `cpu` to init a new Device object. \n\n```py\nfrom device_smi import Device\n\ndev = Device(\"cpu\")\nprint(dev)\n```\n\nOutput: (AMD EPYC 7443)\n\n> {'type': 'cpu', 'model': 'epyc 7443', 'vendor': 'amd', 'memory_total': 1000000000000, 'count': 2, 'cores': 48, 'threads': 96, 'features': ['3dnowprefetch', 'abm', 'adx', 'aes', 'amd_ppin', 'aperfmperf', 'apic', 'arat', 'avx', 'avx2', 'bmi1', 'bmi2', 'bpext', 'brs', 'cat_l3', 'cdp_l3', 'clflush', 'clflushopt', 'clwb', 'clzero', 'cmov', 'cmp_legacy', 'constant_tsc', 'cpb', 'cpuid', 'cqm', 'cqm_llc', 'cqm_mbm_local', 'cqm_mbm_total', 'cqm_occup_llc', 'cr8_legacy', 'cx16', 'cx8', 'de', 'debug_swap', 'decodeassists', 'erms', 'extapic', 'extd_apicid', 'f16c', 'flushbyasid', 'fma', 'fpu', 'fsgsbase', 'fsrm', 'fxsr', 'fxsr_opt', 'ht', 'hw_pstate', 'ibpb', 'ibrs', 'ibs', 'invpcid', 'irperf', 'lahf_lm', 'lbrv', 'lm', 'mba', 'mca', 'mce', 'misalignsse', 'mmx', 'mmxext', 'monitor', 'movbe', 'msr', 'mtrr', 'mwaitx', 'nonstop_tsc', 'nopl', 'npt', 'nrip_save', 'nx', 'ospke', 'osvw', 'overflow_recov', 'pae', 'pat', 'pausefilter', 'pcid', 'pclmulqdq', 'pdpe1gb', 'perfctr_core', 'perfctr_llc', 'perfctr_nb', 'pfthreshold', 'pge', 'pku', 'pni', 'popcnt', 'pse', 'pse36', 'rapl', 'rdpid', 'rdpru', 'rdrand', 'rdseed', 'rdt_a', 'rdtscp', 'rep_good', 'sep', 'sha_ni', 'skinit', 'smap', 'smca', 'smep', 'ssbd', 'sse', 'sse2', 'sse4_1', 'sse4_2', 'sse4a', 'ssse3', 'stibp', 'succor', 'svm', 'svm_lock', 'syscall', 'tce', 'topoext', 'tsc', 'tsc_scale', 'umip', 'user_shstk', 'v_spec_ctrl', 'v_vmsave_vmload', 'vaes', 'vgif', 'vmcb_clean', 'vme', 'vmmcall', 'vpclmulqdq', 'wbnoinvd', 'wdt', 'xgetbv1', 'xsave', 'xsavec', 'xsaveerptr', 'xsaveopt', 'xsaves', 'xtopology']}\n\n\n## Roadmap\n\n- Support AMD GPU\n- Support Intel/Gaudi\n- Support Google/TPU\n- Add NPU support (ARM/Intel/AMD)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Retrieve gpu, cpu, and npu device info and properties from Linux/MacOS with zero package dependency.",
    "version": "0.3.2",
    "project_urls": {
        "Homepage": "https://github.com/ModelCloud/Device-SMI/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a13fb022e88cdde986378c39322dbe1f13d0aa0c1056c548154d802a2a7a14c6",
                "md5": "2bd4b15e692eb26fccfd71d37a30b138",
                "sha256": "202c212d0c2f68fd738c8aeea3ae3f297ca9662e5627282f70f675b6dd74578b"
            },
            "downloads": -1,
            "filename": "device_smi-0.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "2bd4b15e692eb26fccfd71d37a30b138",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3",
            "size": 15047,
            "upload_time": "2024-12-05T13:24:29",
            "upload_time_iso_8601": "2024-12-05T13:24:29.315689Z",
            "url": "https://files.pythonhosted.org/packages/a1/3f/b022e88cdde986378c39322dbe1f13d0aa0c1056c548154d802a2a7a14c6/device_smi-0.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-05 13:24:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ModelCloud",
    "github_project": "Device-SMI",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "device-smi"
}
        
Elapsed time: 0.44687s