Skip to content

Commit 8d0707b

Browse files
authored
update docs (#90)
1 parent 5c97c71 commit 8d0707b

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Self-contained Python lib with zero-dependencies that give you a unified `device
1313
</p>
1414

1515
## News
16+
* 10/01/2025 [0.5.0](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.5.0) Fast (thread interval polled) `.metrics(fast=True)` for low-latency close-to-real-time device resource usage.
1617
* 03/01/2025 [0.4.1](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.4.1) Fix compat with AMD `ROCm` 6.3.2 and `MI300X`.
1718
* 02/26/2025 [0.4.0](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.4.0) Added AMD GPU support. Validated with `amd-smi` on `7900XTX`. Use `PowerShell` for auto-device selection on `Windows` platform.
1819
* 12/20/2024 [0.3.3](https://github.com/ModelCloud/Device-SMI/releases/tag/v0.3.3) Patch fix for Windows install compatibility.
@@ -78,22 +79,31 @@ Output: (AMD EPYC 7443)
7879

7980
> {'memory_total': 2151497490432, 'type': 'cpu', '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', 'sev', 'sev_es', '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'], 'vendor': 'amd', 'model': 'epyc 7443', 'count': 2, 'cores': 48, 'threads': 96}
8081

82+
### Runtime metrics
83+
84+
Use `device.metric()` to fetch the latest utilization snapshot for any supported device. The returned object exposes attributes such as `memory_used`, `memory_process`, and `utilization`.
85+
86+
```py
87+
from device_smi import Device
88+
89+
dev = Device("cuda:0")
90+
stats = dev.metric()
91+
print(stats.memory_used, stats.utilization)
92+
```
93+
8194
### Fast metrics cache
8295

83-
GPU metrics that depend on vendor SMI utilities can be slow. You can opt into a fast, cached version of the runtime data by calling `Device.metrics(fast=True)`. Cached data is refreshed in the background every 200ms by default:
96+
GPU metrics that depend on vendor SMI utilities can be slow. You can opt into a fast, cached version of the runtime data by calling `Device.metric(fast=True)`. Cached data is refreshed in the background every 200ms by default:
8497

8598
```py
8699
from device_smi import Device
87100

88101
dev = Device("cuda:0", fast_metrics_interval=0.200)
89102

90-
metrics = dev.metrics(fast=True)
91-
print(metrics.memory_used, metrics.utilization)
103+
stats = dev.metric(fast=True)
104+
print(stats.memory_used, stats.utilization)
92105
```
93106

94-
CPU devices already return metrics quickly, so the fast path is identical to the standard call and does not spawn background threads.
95-
96-
97107
## Roadmap
98108

99109
- Support Intel/Gaudi

0 commit comments

Comments
 (0)