{"id":26384342,"url":"https://github.com/serengil/gpuutils","last_synced_at":"2025-08-21T19:13:27.290Z","repository":{"id":57435621,"uuid":"257503640","full_name":"serengil/gpuutils","owner":"serengil","description":"GpuUtils: A Simple Tool for GPU Analysis and Allocation","archived":false,"fork":false,"pushed_at":"2020-04-23T16:05:03.000Z","size":154,"stargazers_count":15,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-22T23:14:29.753Z","etag":null,"topics":["cuda","gpu","nvidia","nvidia-smi"],"latest_commit_sha":null,"homepage":"https://sefiks.com/","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/serengil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-04-21T06:43:55.000Z","updated_at":"2025-02-19T15:27:31.000Z","dependencies_parsed_at":"2022-09-17T03:51:22.527Z","dependency_job_id":null,"html_url":"https://github.com/serengil/gpuutils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/serengil/gpuutils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serengil%2Fgpuutils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serengil%2Fgpuutils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serengil%2Fgpuutils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serengil%2Fgpuutils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serengil","download_url":"https://codeload.github.com/serengil/gpuutils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serengil%2Fgpuutils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271526548,"owners_count":24775470,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cuda","gpu","nvidia","nvidia-smi"],"created_at":"2025-03-17T07:23:01.983Z","updated_at":"2025-08-21T19:13:27.226Z","avatar_url":"https://github.com/serengil.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GpuUtils\n\n[![Downloads](https://pepy.tech/badge/gpuutils)](https://pepy.tech/project/gpuutils)\n\nWorking on a shared and distributed environment with multiple GPUs might be problematic. Advanced frameworks apply greedy approach and they tend to allocate all GPUs and all memory of your system. GpuUtils helps you to find the best GPU on your system to allocate. It also provides a gpu related information in a structure format.\n\n## Installation\n\nThe easiest way to install GpuUtils is to install it via [PyPI](https://pypi.org/project/gpuutils).\n\n```\npip install gpuutils\n```\n\n## Analyzing system\n\nRunning **nvidia-smi** command in the command prompt allows users to monitor GPU related information such as memory and utilization. Herein, system analysis function loads GPU related information into a pandas data frame or json array.\n\n```python\nfrom gpuutils import GpuUtils\ndf = GpuUtils.analyzeSystem() #this will return a pandas data frame\n#dict = GpuUtils.analyzeSystem(pandas_format = False) #this will return a json array\n```\n\nDefault configuration of system analysis returns a Pandas data frame.\n\n| gpu_index | total_memories_in_mb | available_memories_in_mb | memory_usage_percentage | utilizations | power_usages_in_watts | power_capacities_in_watts |\n| ---       | ---                  | ---                      | ---                     | ---          | ---                   | ---                       |\n| 1         | 32480                | 32469                    | 0.0339                  | 0            | 43                    | 300                       |\n| 2         | 32480                | 32469                    | 0.0339                  | 0            | 43                    | 300                       |\n| 3         | 32480                | 32469                    | 0.0339                  | 0            | 44                    | 300                       |\n| 4         | 32480                | 32469                    | 0.0339                  | 0            | 43                    | 300                       |\n| 5         | 32480                | 32469                    | 0.0339                  | 0            | 43                    | 300                       |\n| 6         | 32480                | 32469                    | 0.0339                  | 0            | 43                    | 300                       |\n| 7         | 32480                | 32469                    | 0.0339                  | 0            | 43                    | 300                       |\n| 0         | 32480                | 31031                    | 4.4612                  | 7            | 56                    | 300                       |\n\n## Allocation\n\nGpuUtils can allocate GPUs as well. Calling allocation function directly finds the available GPUs and allocate based on your demand.\n\n```python\nfrom gpuutils import GpuUtils\nGpuUtils.allocate() #this tries to allocate a GPU having 1GB memory\n#GpuUtils.allocate(required_memory = 10000)\n#GpuUtils.allocate(required_memory = 10000, gpu_count=1)\n```\n\n# To avoid greedy approach\n\nAdvanced frameworks such as TensorFlow tend to allocate all memory. You can avoid this approach if you pass the framework argument in allocate function. In this way, the framework will use the gpu memory as much as needed. Currently, keras and tensorflow frameworks are supported in allocate function.\n\n```python\nGpuUtils.allocate(framework = 'keras')\n```\n\n# Support\n\nThere are many ways to support a project - starring⭐️ the GitHub repos is just one.\n\n# Licence\n\nGpuUtils is licensed under the MIT License - see [`LICENSE`](https://github.com/serengil/gpuutils/blob/master/LICENSE) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserengil%2Fgpuutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserengil%2Fgpuutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserengil%2Fgpuutils/lists"}