nvgpu - NVIDIA GPU tools
It provides information about GPUs and their availability for computation.
Often we want to train a ML model on one of GPUs installed on a multi-GPU machine. Since TensorFlow allocates all memory, only one such process can use the GPU at a time. Unfortunately nvidia-smi provides only a text interface with information about GPUs. This packages wraps it with an easier to use CLI and Python interface.
It’s a quick and dirty solution calling nvidia-smi and parsing its output. We can take one or more GPUs availabile for computation based on relative memory usage, ie. it is OK with Xorg taking a few MB.
In addition we have a fancy table of GPU with more information taken by python binding to NVML.
Installing
pip install nvgpu
Usage examples
Command-line interface:
# grab all available GPUs CUDA_VISIBLE_DEVICES=$(nvgpu available) # grab at most available GPU CUDA_VISIBLE_DEVICES=$(nvgpu available -l 1)
Print pretty colored table of devices, availability, users, processes:
$ nvgpu list
status type util. temp. MHz users since pids cmd
-- -------- ------------------- ------- ------- ----- ------- --------------- ------ --------
0 [ ] GeForce GTX 1070 0 % 44 139
1 [~] GeForce GTX 1080 Ti 0 % 44 139 alice 2 days ago 19028 jupyter
2 [~] GeForce GTX 1080 Ti 0 % 44 139 bob 14 hours ago 8479 jupyter
3 [~] GeForce GTX 1070 46 % 54 1506 bob 7 days ago 20883 train.py
4 [~] GeForce GTX 1070 35 % 64 1480 bob 7 days ago 26228 evaluate.py
5 [!] GeForce GTX 1080 Ti 0 % 44 139 ? 9305
6 [ ] GeForce GTX 1080 Ti 0 % 44 139
Or shortcut:
$ nvl
Python API:
import nvgpu
nvgpu.available_gpus()
# ['0', '2']
nvgpu.gpu_info()
[{'index': '0',
'mem_total': 8119,
'mem_used': 7881,
'mem_used_percent': 97.06860450794433,
'type': 'GeForce GTX 1070',
'uuid': 'GPU-3aa99ee6-4a9f-470e-3798-70aaed942689'},
{'index': '1',
'mem_total': 11178,
'mem_used': 10795,
'mem_used_percent': 96.57362676686348,
'type': 'GeForce GTX 1080 Ti',
'uuid': 'GPU-60410ded-5218-7b06-9c7a-124b77a22447'},
{'index': '2',
'mem_total': 11178,
'mem_used': 10789,
'mem_used_percent': 96.51994990159241,
'type': 'GeForce GTX 1080 Ti',
'uuid': 'GPU-d0a77bd4-cc70-ca82-54d6-4e2018cfdca6'},
...
]
TODO
order GPUs by priority (decreasing power, decreasing free memory)
Metadata
Release files for nvgpu 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nvgpu-0.5.1.tar.gz | 5.0 kB | Without provenance | Details for nvgpu-0.5.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nvgpu-0.5.1-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for nvgpu-0.5.1-py2.py3-none-any.whl |
Total release size: 10.4 kB
Release files / nvgpu-0.5.1.tar.gz
| Download URL | nvgpu-0.5.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a34d8e3ea0dd200924ab9fb27a9256b0e705937d6f867ece89e6aee6656fc8a5
|
|
BLAKE2b-256 checksum How to use checksums |
0de71beebc4b775701cbbbe8b75d47652425f91012b922fc5395fe246ab40209
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / nvgpu-0.5.1-py2.py3-none-any.whl
| Download URL | nvgpu-0.5.1-py2.py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
06b6cb8f12f51ced44a478f1aabf2d70ed38c70ecc8200002e471a1547782c05
|
|
BLAKE2b-256 checksum How to use checksums |
bbfb6a4d4988c6af702c504d96934364660a98e4eb462c5165e5a128ec91e0d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for nvgpu 0.5.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.