{"id":15066294,"url":"https://github.com/sicara/gpumonitor","last_synced_at":"2025-04-10T13:42:46.958Z","repository":{"id":57435622,"uuid":"259234974","full_name":"sicara/gpumonitor","owner":"sicara","description":"TF 2.x and PyTorch Lightning Callbacks for GPU monitoring","archived":false,"fork":false,"pushed_at":"2020-06-08T10:25:18.000Z","size":2185,"stargazers_count":92,"open_issues_count":1,"forks_count":7,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-24T12:21:44.918Z","etag":null,"topics":["gpu-monitoring","pytorch-lightning","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sicara.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-27T07:12:34.000Z","updated_at":"2024-01-04T16:45:17.000Z","dependencies_parsed_at":"2022-09-17T03:51:17.127Z","dependency_job_id":null,"html_url":"https://github.com/sicara/gpumonitor","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sicara%2Fgpumonitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sicara%2Fgpumonitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sicara%2Fgpumonitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sicara%2Fgpumonitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sicara","download_url":"https://codeload.github.com/sicara/gpumonitor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248226251,"owners_count":21068169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gpu-monitoring","pytorch-lightning","tensorflow"],"created_at":"2024-09-25T01:05:10.762Z","updated_at":"2025-04-10T13:42:46.942Z","avatar_url":"https://github.com/sicara.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gpumonitor\n\n[![Pypi Version](https://img.shields.io/pypi/v/gpumonitor.svg)](https://pypi.org/project/gpumonitor/)\n![Licence](https://img.shields.io/pypi/l/gpumonitor)\n![Frameworks](https://img.shields.io/badge/Frameworks-PyTorchLightning%20|%20TensorFlow-blue.svg)\n\n\n`gpumonitor` gives you **stats about GPU** usage during execution of your scripts and trainings,\nas [TensorFlow](https://www.github.com/tensorflow/tensorflow) or \n[Pytorch Lightning](https://github.com/PyTorchLightning/pytorch-lightning) callbacks.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./assets/callbacks.png\" width=\"800\" /\u003e\n\u003c/p\u003e\n\n\n## Installation\n\nInstallation can be done directly from this repository:\n\n```\npip install gpumonitor\n```\n\n## Getting started\n\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"./assets/gpumonitor.gif\" width=\"1000\" /\u003e\n\u003c/p\u003e\n\n### Option 1: In your scripts\n\n```python\nmonitor = gpumonitor.GPUStatMonitor(delay=1)\n\n# Your instructions here\n# [...]\n\nmonitor.stop()\nmonitor.display_average_stats_per_gpu()\n```\n\nIt keeps track of the average of GPU statistics. To reset the average and start from fresh, you can also reset the monitor:\n\n```python\nmonitor = gpumonitor.GPUStatMonitor(delay=1)\n\n# Your instructions here\n# [...]\n\nmonitor.display_average_stats_per_gpu()\nmonitor.reset()\n\n# Some other instructions\n# [...]\n\nmonitor.display_average_stats_per_gpu()\n```\n\n### Option 2: Callbacks\n\nAdd the following callback to your training loop:\n\nFor [TensorFlow](https://www.github.com/tensorflow/tensorflow),\n\n```python\nfrom gpumonitor.callbacks.tf import TFGpuMonitorCallback\n\nmodel.fit(x, y, callbacks=[TFGpuMonitorCallback(delay=0.5)])\n```\n\nFor [PyTorch Lightning](https://github.com/PyTorchLightning/pytorch-lightning),\n\n```python\nfrom gpumonitor.callbacks.lightning import PyTorchGpuMonitorCallback\n\ntrainer = pl.Trainer(callbacks=[PyTorchGpuMonitorCallback(delay=0.5)])\ntrainer.fit(model)\n```\n\n## Display Format\n\nYou can customize the display format according to the `gpustat` options. For example, display of watts consumption,\nfan speed are available. To know which options you can change, refer to:\n\n- [TensorFlow callback example](https://github.com/sicara/gpumonitor/blob/42237f423254e8fc7ae21e8f2811533a4264064d/scripts/tf_training.py#L16)\n- [`gpustat print_to()` docstring](https://github.com/wookayin/gpustat/blob/aba85f8eba9f7861022eb3dcc06ff771b451b3e1/gpustat/core.py#L178)\n\n## Sources\n\n- Built on top of [GPUStat](https://github.com/wookayin/gpustat)\n- Separate thread loop coming from [gputil](https://github.com/anderskm/gputil)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsicara%2Fgpumonitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsicara%2Fgpumonitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsicara%2Fgpumonitor/lists"}