{"id":26047922,"url":"https://github.com/hurricane1988/check-gpu-device","last_synced_at":"2025-07-10T09:33:26.051Z","repository":{"id":280982753,"uuid":"943728243","full_name":"hurricane1988/check-gpu-device","owner":"hurricane1988","description":"✨本项目是一个基于 Flask + Gunicorn + NVIDIA CUDA 的 API 服务，提供 CUDA 设备信息查询 和 健康检查 接口。支持 GPU 运行，可用于 深度学习推理环境 部署","archived":false,"fork":false,"pushed_at":"2025-05-13T20:38:38.000Z","size":18,"stargazers_count":3,"open_issues_count":3,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-06T03:41:10.233Z","etag":null,"topics":["cuda","docker","makefile","nvidia","python3","pytorch"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hurricane1988.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-06T07:04:51.000Z","updated_at":"2025-04-18T02:31:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"3de9b798-1a2b-4f9d-a114-10ab2af93352","html_url":"https://github.com/hurricane1988/check-gpu-device","commit_stats":null,"previous_names":["hurricane1988/check-gpu-device"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/hurricane1988/check-gpu-device","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hurricane1988%2Fcheck-gpu-device","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hurricane1988%2Fcheck-gpu-device/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hurricane1988%2Fcheck-gpu-device/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hurricane1988%2Fcheck-gpu-device/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hurricane1988","download_url":"https://codeload.github.com/hurricane1988/check-gpu-device/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hurricane1988%2Fcheck-gpu-device/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264559165,"owners_count":23628037,"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":["cuda","docker","makefile","nvidia","python3","pytorch"],"created_at":"2025-03-07T23:15:09.354Z","updated_at":"2025-07-10T09:33:26.046Z","avatar_url":"https://github.com/hurricane1988.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 📌 项目简介\n本项目是一个基于 Flask + Gunicorn + NVIDIA CUDA 的 API 服务，提供 CUDA 设备信息查询 和 健康检查 接口。支持 GPU 运行，可用于 深度学习推理环境 部署\n\n---\n\n## ✨ 功能特性\n- ✅ 健康检查 (/healthz) —— 确保服务正常运行\n- ✅ CUDA 设备信息 (/device) —— 查询 NVIDIA GPU 设备状态\n- ✅ Gunicorn 生产级 WSGI 服务器 —— 提供高性能 API\n- ✅ 非 root 运行 —— 提高安全性\n- ✅ Docker/Kubernetes部署支持 —— 适用于容器化环境\n\n---\n\n## 🚀 快速开始\n### 1️⃣ 本地运行（仅开发环境）\n执行帮忙\n```shell\nmake help\n```\n```shell\nUsage:\n  make \u003ctarget\u003e\n\nGeneral\n  help             Display this help.\n\nDevelopment\n  freeze           Run pip freeze export the python library.\n  run              Run a main.py script from your host.\n\nBuild\n  docker-build     Build docker image with the check-nvidia-cuda.\n  docker-push      Push docker image with the check-nvidia-cuda.\n  docker-buildx    Build and push docker image for the check-gpu-check for cross-platform support.\n```\n安装依赖\n```shell\npip install -r requirements.txt\n```\n启动服务\n```shell\ngunicorn -b 0.0.0.0:8000 --access-logfile - main:app\n```\n访问 API\n```shell\ncurl http://127.0.0.1:8000/healthz\ncurl http://127.0.0.1:8000/device\n```\n---\n### 2️⃣ Docker 运行（推荐方式）\n构建 Docker 镜像\n```shell\nmake docker-build\n```\n运行容器\n```shell\ndocker run --gpus all -p 8000:8000 --rm check-gpu-device\n```\n\n```shell\nchecking nvidia-cuda environment...\n✅ NVIDIA CUDA is available!\n+------------------+-------------+\n| Property         | Value       |\n+==================+=============+\n| PyTorch Version  | 2.6.0+cu124 |\n+------------------+-------------+\n| CUDA Version     | 12.4        |\n+------------------+-------------+\n| GPU Device Count | 2           |\n+------------------+-------------+\n+----------+----------+----------------+-------------------+--------------------+-----------------+\n|   Device | Name     | Total Memory   | Reserved Memory   | Allocated Memory   | Max Allocated   |\n+==========+==========+================+===================+====================+=================+\n|        0 | Tesla T4 | 14.58 GB       | 0.00 GB           | 0.00 GB            | 0.00 GB         |\n+----------+----------+----------------+-------------------+--------------------+-----------------+\n|        1 | Tesla T4 | 14.58 GB       | 0.00 GB           | 0.00 GB            | 0.00 GB         |\n+----------+----------+----------------+-------------------+--------------------+-----------------+\n```\n\n```shell\ncurl http://127.0.0.1:8000/device\n```\n```shell\n{\n    \"cuda_version\": \"12.4\",\n    \"gpu_count\": 2,\n    \"gpus\": [\n        {\n            \"allocated_memory_gb\": 0,\n            \"id\": 0,\n            \"max_allocated_memory_gb\": 0,\n            \"name\": \"Tesla T4\",\n            \"reserved_memory_gb\": 0,\n            \"total_memory_gb\": 14.5775146484375\n        },\n        {\n            \"allocated_memory_gb\": 0,\n            \"id\": 1,\n            \"max_allocated_memory_gb\": 0,\n            \"name\": \"Tesla T4\",\n            \"reserved_memory_gb\": 0,\n            \"total_memory_gb\": 14.5775146484375\n        }\n    ],\n    \"pytorch_version\": \"2.6.0+cu124\",\n    \"status\": \"available\"\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhurricane1988%2Fcheck-gpu-device","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhurricane1988%2Fcheck-gpu-device","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhurricane1988%2Fcheck-gpu-device/lists"}