# nvidia-htop
A tool for enriching the output of `nvidia-smi`.
![CI](https://github.com/peci1/nvidia-htop/workflows/CI/badge.svg)
[![PyPI version](https://badge.fury.io/py/nvidia-htop.svg)](https://badge.fury.io/py/nvidia-htop)
# Install
`pip3 install nvidia-htop`
**Yes, this tool has been on PyPi since 2021! Enjoy the super-easy way to install it.**
## Usage
nvidia-htop.py [-l [length]]
print GPU utilization with usernames and CPU stats for each GPU-utilizing process
-l|--command-length [length] Print longer part of the commandline. If `length'
is provided, use it as the commandline length,
otherwise print first 100 characters.
-c|--color Colorize the output (green - free GPU, yellow -
moderately used GPU, red - fully used GPU)
-u|--user USER[,USER] Limit the list of processes to selected users
(comma-separated).
-i|--id ID[,ID[,ID]] Limit the command to selected GPU IDs (comma-separated).
Note: for backward compatibility, `nvidia-smi | nvidia-htop.py [-l [length]]` is also supported.
Note: running inside a container (docker, singularity, ...), `nvidia-smi` can only see processes running in the container.
Note: To periodically check the output of nvidia-htop, use the `watch` utility: `watch nvidia-htop.py`. To get colored output, you have to pass option `-c` to both `watch` and `nvidia-htop`, e.g. `watch -c nvidia-htop.py -c`.
## Example output
$ nvidia-htop.py -l
Mon May 21 15:06:35 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.25 Driver Version: 390.25 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 108... Off | 00000000:04:00.0 Off | N/A |
| 53% 75C P2 174W / 250W | 10807MiB / 11178MiB | 97% Default |
+-------------------------------+----------------------+----------------------+
| 1 GeForce GTX 108... Off | 00000000:05:00.0 Off | N/A |
| 66% 82C P2 220W / 250W | 10783MiB / 11178MiB | 100% Default |
+-------------------------------+----------------------+----------------------+
| 2 GeForce GTX 108... Off | 00000000:08:00.0 Off | N/A |
| 45% 67C P2 85W / 250W | 10793MiB / 11178MiB | 51% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| GPU PID USER GPU MEM %MEM %CPU COMMAND |
| 0 1032 anonymou 10781MiB 308 3.7 python train_image_classifier.py --train_dir=/mnt/xxxxxxxx/xxxxxxxx/xxxxxxxx/xxxxxxx/xxxxxxxxxxxxxxx |
| 1 11021 cannotte 10765MiB 114 1.5 python3 ./train.py --flagfile /xxxxxxxx/xxxxxxxx/xxxxxxxx/xxxxxxxxx/xx/xxxxxxxxxxxxxxx |
| 2 25544 nevermin 10775MiB 108 2.0 python -m xxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
+-----------------------------------------------------------------------------+
## Screenshot with output coloring
![Screenshot](screen.png)
Raw data
{
"_id": null,
"home_page": "https://github.com/peci1/nvidia-htop",
"name": "nvidia-htop",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.5",
"maintainer_email": null,
"keywords": "nvidia, nvidia-smi, GPU, htop, top",
"author": "Martin Pecka",
"author_email": "peci1@seznam.cz",
"download_url": "https://files.pythonhosted.org/packages/8f/b3/65c7ea72dfc901ebf3abec5aabb73ad6cadaf08c2c343a1db1813bc4b667/nvidia-htop-1.2.0.tar.gz",
"platform": null,
"description": "# nvidia-htop\n\nA tool for enriching the output of `nvidia-smi`.\n\n![CI](https://github.com/peci1/nvidia-htop/workflows/CI/badge.svg)\n[![PyPI version](https://badge.fury.io/py/nvidia-htop.svg)](https://badge.fury.io/py/nvidia-htop)\n\n# Install\n`pip3 install nvidia-htop`\n\n**Yes, this tool has been on PyPi since 2021! Enjoy the super-easy way to install it.**\n\n\n\n## Usage\n\n nvidia-htop.py [-l [length]]\n print GPU utilization with usernames and CPU stats for each GPU-utilizing process\n\n -l|--command-length [length] Print longer part of the commandline. If `length'\n is provided, use it as the commandline length,\n otherwise print first 100 characters.\n -c|--color Colorize the output (green - free GPU, yellow -\n moderately used GPU, red - fully used GPU)\n -u|--user USER[,USER] Limit the list of processes to selected users\n (comma-separated).\n -i|--id ID[,ID[,ID]] Limit the command to selected GPU IDs (comma-separated).\n\nNote: for backward compatibility, `nvidia-smi | nvidia-htop.py [-l [length]]` is also supported.\n\nNote: running inside a container (docker, singularity, ...), `nvidia-smi` can only see processes running in the container.\n\nNote: To periodically check the output of nvidia-htop, use the `watch` utility: `watch nvidia-htop.py`. To get colored output, you have to pass option `-c` to both `watch` and `nvidia-htop`, e.g. `watch -c nvidia-htop.py -c`.\n\n## Example output\n\n $ nvidia-htop.py -l\n Mon May 21 15:06:35 2018\n +-----------------------------------------------------------------------------+\n | NVIDIA-SMI 390.25 Driver Version: 390.25 |\n |-------------------------------+----------------------+----------------------+\n | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n |===============================+======================+======================|\n | 0 GeForce GTX 108... Off | 00000000:04:00.0 Off | N/A |\n | 53% 75C P2 174W / 250W | 10807MiB / 11178MiB | 97% Default |\n +-------------------------------+----------------------+----------------------+\n | 1 GeForce GTX 108... Off | 00000000:05:00.0 Off | N/A |\n | 66% 82C P2 220W / 250W | 10783MiB / 11178MiB | 100% Default |\n +-------------------------------+----------------------+----------------------+\n | 2 GeForce GTX 108... Off | 00000000:08:00.0 Off | N/A |\n | 45% 67C P2 85W / 250W | 10793MiB / 11178MiB | 51% Default |\n +-------------------------------+----------------------+----------------------+\n\n +-----------------------------------------------------------------------------+\n | GPU PID USER GPU MEM %MEM %CPU COMMAND |\n | 0 1032 anonymou 10781MiB 308 3.7 python train_image_classifier.py --train_dir=/mnt/xxxxxxxx/xxxxxxxx/xxxxxxxx/xxxxxxx/xxxxxxxxxxxxxxx |\n | 1 11021 cannotte 10765MiB 114 1.5 python3 ./train.py --flagfile /xxxxxxxx/xxxxxxxx/xxxxxxxx/xxxxxxxxx/xx/xxxxxxxxxxxxxxx |\n | 2 25544 nevermin 10775MiB 108 2.0 python -m xxxxxxxxxxxxxxxxxxxxxxxxxxxxx |\n +-----------------------------------------------------------------------------+\n\n## Screenshot with output coloring\n\n![Screenshot](screen.png)\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A tool for enriching the output of nvidia-smi",
"version": "1.2.0",
"project_urls": {
"Bug Reports": "https://github.com/peci1/nvidia-htop/issues",
"Homepage": "https://github.com/peci1/nvidia-htop",
"Source": "https://github.com/peci1/nvidia-htop"
},
"split_keywords": [
"nvidia",
" nvidia-smi",
" gpu",
" htop",
" top"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d69b82824718a275c4becfcfe2246d2fb2912d5b637d0743d3f748142ad46c9b",
"md5": "4652ead291e3a46b8989f2b8209fadfb",
"sha256": "3fd853938d3abe2b04fbc99533d5185af5e21acd884f22449d012ca0cf84e4c9"
},
"downloads": -1,
"filename": "nvidia_htop-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4652ead291e3a46b8989f2b8209fadfb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.5",
"size": 7077,
"upload_time": "2024-03-23T17:41:08",
"upload_time_iso_8601": "2024-03-23T17:41:08.302988Z",
"url": "https://files.pythonhosted.org/packages/d6/9b/82824718a275c4becfcfe2246d2fb2912d5b637d0743d3f748142ad46c9b/nvidia_htop-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8fb365c7ea72dfc901ebf3abec5aabb73ad6cadaf08c2c343a1db1813bc4b667",
"md5": "fd54fc1730fd89846716a03fc3175c99",
"sha256": "106e5d0e844ac985ba0f7e74953ef2471e27bc58b0e67484a5775676157fe0a8"
},
"downloads": -1,
"filename": "nvidia-htop-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "fd54fc1730fd89846716a03fc3175c99",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.5",
"size": 7451,
"upload_time": "2024-03-23T17:41:10",
"upload_time_iso_8601": "2024-03-23T17:41:10.201119Z",
"url": "https://files.pythonhosted.org/packages/8f/b3/65c7ea72dfc901ebf3abec5aabb73ad6cadaf08c2c343a1db1813bc4b667/nvidia-htop-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-23 17:41:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "peci1",
"github_project": "nvidia-htop",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "termcolor",
"specs": []
}
],
"lcname": "nvidia-htop"
}