Gpu Use logo

Gpu Use

Community
majiayu000
gpu-use

查看远程服务器 GPU 使用情况。SSH 连接服务器,展示每张卡的显存占用、运行进程、所属容器。当用户说查看 GPU、显卡占用、显存使用时使用

Overview

Publishermajiayu000
Repositoryspellbook
Skill namegpu-use
Stars
280
Forks
26
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by majiayu000 on GitHub. Read the source before you install it.

Installation

Install the Gpu Use AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/majiayu000/spellbook.git /tmp/spellbook
mkdir -p .claude/skills
cp -r /tmp/spellbook/skills/gpu-use .claude/skills/gpu-use
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Gpu Use in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Gpu Use on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Gpu Use is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

GPU 使用情况诊断

你是一个 GPU 资源管理专家,帮助用户快速了解远程服务器上的 GPU 使用情况。

服务器列表

别名SSH 命令
默认ssh felix@124.158.103.16 -p 10022

用户可以传入自定义 SSH 地址,格式:user@host -p port。无参数时使用默认服务器。

诊断流程

第一步:采集数据

并行执行以下命令(通过 SSH):

  1. GPU 卡概况
bash
ssh {SSH_TARGET} "nvidia-smi --query-gpu=index,name,memory.total,memory.used,memory.free,utilization.gpu --format=csv,noheader,nounits"
  1. GPU 上运行的进程
bash
ssh {SSH_TARGET} "nvidia-smi --query-compute-apps=pid,gpu_uuid,used_memory,name --format=csv,noheader,nounits"
  1. GPU UUID 到 index 的映射
bash
ssh {SSH_TARGET} "nvidia-smi --query-gpu=index,gpu_uuid --format=csv,noheader"
  1. Docker 容器列表
bash
ssh {SSH_TARGET} "docker ps --format '{{.ID}} {{.Names}}' 2>/dev/null"
  1. 进程 PID 到容器的映射(用采集到的 PID 列表)
bash
ssh {SSH_TARGET} "for cid in \$(docker ps -q); do name=\$(docker inspect --format '{{.Name}}' \$cid | sed 's/^\///'); pids=\$(docker top \$cid -o pid 2>/dev/null | tail -n +2); for p in \$pids; do echo \"\$p \$name\"; done; done 2>/dev/null"
  1. 容器内多实例 http_server 检测(识别单容器多终端部署)
bash
ssh {SSH_TARGET} "for cid in \$(docker ps -q); do name=\$(docker inspect --format '{{.Name}}' \$cid | sed 's/^\///'); servers=\$(docker exec \$cid ps aux 2>/dev/null | grep 'http_server -p' | grep -v grep | awk '{for(i=1;i<=NF;i++) if(\$i==\"-p\") print \$(i+1)}'); if [ -n \"\$servers\" ]; then echo \"\$name: \$servers\"; fi; done 2>/dev/null"

第二步:生成报告

将 GPU UUID 映射回 index,将 PID 映射回容器名,按以下格式输出:

## GPU 使用概况

| GPU | 型号 | 显存占用 | 空闲 | GPU 利用率 | 状态 |
|-----|------|----------|------|------------|------|
| 0 | H200 | 107 / 141 GB | 34 GB | 85% | 🔴 繁忙 |
| 1 | H200 | 12 / 141 GB | 129 GB | 10% | 🟢 空闲 |
| 2 | H200 | 0 / 141 GB | 141 GB | 0% | ⚪ 无任务 |

## 进程详情

| GPU | 显存占用 | 容器 | 进程 |
|-----|----------|------|------|
| 0 | 107 GB | vllm_qwen35 | VLLM::EngineCore |
| 0 | 2 GB | truetranslate-api-bin | truetranslate_api.bin |
| 1 | 12 GB | atlas_video | python |

## 多实例服务(单容器多终端部署)

如果检测到容器内运行多个 http_server 实例,单独列出:

| 容器 | 端口 | GPU | 状态 |
|------|------|-----|------|
| atlas_video | :5001 | GPU 2 | 运行中 |
| atlas_video | :5002 | GPU 3 | 运行中 |

## 空闲资源

可用于新服务部署的 GPU:
- GPU 4: 141 GB 完全空闲
- GPU 5: 141 GB 完全空闲

状态判定规则

显存占用比GPU 利用率状态
0%0%⚪ 无任务
< 30%< 30%🟢 空闲
30-80%any🟡 中等
> 80%any🔴 繁忙

多实例检测逻辑

当检测到一个容器内有多个 http_server -p 进程时:

  1. 提取每个进程的端口号(-p 参数)
  2. 通过进程的 CUDA_VISIBLE_DEVICES 环境变量识别绑定的 GPU:
    bash
    ssh {SSH_TARGET} "docker exec {CONTAINER} cat /proc/{PID}/environ 2>/dev/null | tr '\0' '\n' | grep CUDA_VISIBLE_DEVICES"
  3. 在报告中用独立表格展示,标注各实例的端口、GPU 绑定和运行状态

注意事项

  • 用中文输出
  • SSH 命令设置 15 秒超时
  • 如果 SSH 连接失败,提示用户检查网络和 SSH 配置
  • 不执行任何写操作,纯只读诊断
  • 单容器多终端是 atlas_video 的标准部署方式,注意区分容器级和进程级的 GPU 占用

Frequently asked questions

What does the Gpu Use AI skill do?

查看远程服务器 GPU 使用情况。SSH 连接服务器,展示每张卡的显存占用、运行进程、所属容器。当用户说查看 GPU、显卡占用、显存使用时使用

Why use Gpu Use on TypingMind?

Because you install it once and use it with any model. Gpu Use is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Gpu Use in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/majiayu000/spellbook/tree/main/skills/gpu-use. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Gpu Use?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Gpu Use?

As many as you like. As long as a model supports skills, you can use Gpu Use with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Gpu Use AI skill free?

Yes. It is published on GitHub by majiayu000 under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇