gpu-manage
Skill2 starsChanged 7 months agoMITView on GitHub
Use BEFORE launching ANY GPU-using experiment, training, evaluation, or inference. Inspects available GPUs (via nvidia-smi or equivalent), shows their current memory, utilization, and running processes in a table, and EXPLICITLY waits for user confirmation on which GPU indices to use before any compute is spent. Output is shown inline AND appended to ./experiments/<name>-gpu-plan.md (or ./gpu-plan.md for ad-hoc) — append-only ledger of pre-flight checks. Hard rule: NO GPU work starts without a user-confirmed selection.
In this repository4 other files it gives its agents.
- exp-designSkill
- exp-trackingSkill
- lit-reviewSkill
- review-writingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 3 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
This skill is a HARD GATE: No downstream skill (exp-tracking, training scripts, anything that touches CUDA) launches GPU work without first …
- Very specific: line 14
BEFORE invoking exp-tracking to launch experiments
- Distinctive: line 15
BEFORE running training, fine-tuning, evaluation, or inference scripts that touch GPU
- Distinctive: line 16
BEFORE allocating multi-GPU jobs (DDP, model-parallel, tensor-parallel, etc.)
- Very specific: line 17
When re-checking GPU state mid-sweep (a new check appends a new Table N+1)
- Distinctive: line 27
Every invocation produces TWO artifacts:
- Very specific: line 38
Run nvidia-smi --query-gpu=index,name,memory.total,memory.used,memory.free,utilization.gpu --format=csv,noheader,nounits (or platform …
- Very specific: line 42
After the user replies, append Table N+1 with your choice filled in (✓ selected, — skipped) and the resulting CUDA_VISIBLE_DEVICES=...
- Very specific: line 43
Only then signal that downstream work (e.g., exp-tracking) may proceed with the agreed device list.
- Very specific: line 45
If nvidia-smi fails or returns no devices (no GPU, no driver, remote machine without access): say so explicitly, append a one-row table …
- Very specific: line 77
Detect: Run nvidia-smi. If it fails, surface the failure in a one-row table with status=n/a — no GPU detected and ask whether to proceed …
- Very specific: line 81
WAIT: Do NOT proceed with any GPU work, do NOT issue any CUDA call, do NOT start exp-tracking, until the user replies with a specific …
- Very specific: line 82
Confirm: When the user replies, append Table N+1 with your choice column filled in.
- Very specific: line 83
Hand-off: Only after the confirmation table is appended may downstream tools launch jobs.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GPU Management — Pre-Flight Selection
GPU allocation is a table written to a markdown file with EXPLICIT user confirmation, not a silent default. Before a single training step, evaluation, or inference call hits the GPU, this skill: (1) inspects what's actually available, (2) presents it as a table, (3) STOPS and waits for the user to confirm which GPUs to use, (4) records the selection in a markdown file as part of the experiment ledger.
This skill is a HARD GATE. No downstream skill (exp-tracking, training scripts, anything that touches CUDA) launches GPU work without first running through gpu-manage and getting explicit user confirmation on the device list.
When to Use
- BEFORE invoking
exp-trackingto launch experiments - BEFORE running training, fine-tuning, evaluation, or inference scripts that touch GPU
- BEFORE allocating multi-GPU jobs (DDP, model-parallel, tensor-parallel, etc.)
- When re-checking GPU state mid-sweep (a new check appends a new
Table N+1)
When NOT to Use
- Pure CPU work (no GPU involved)
- Reading code or papers (no compute)
- Debugging logic that doesn't touch a GPU
Output Contract — Both Inline AND File (Append-Only)
Every invocation produces TWO artifacts:
- Inline — the LATEST GPU table (
Table N+1) with caption, in chat. - File — append the new table at the END of
./experiments/<name>-gpu-plan.md(when associated with a sweep, use the same<name>as the design/tracking files). For ad-hoc checks not tied to a sweep, use./gpu-plan.mdat the project root. Use the Edit tool to APPEND, never the Write tool to overwrite. Earlier checks MUST stay intact.
The file is an append-only ledger of pre-flight checks: Table 1 (initial check before R1) → Table 2 (re-check before R3 after another user freed up GPU 2) → … → Table N. The trajectory shows which GPUs were available when each decision was made and which the user picked.
The Hard Gate (non-negotiable)
This skill MUST complete with EXPLICIT user confirmation before returning control. The flow:
- Run
nvidia-smi --query-gpu=index,name,memory.total,memory.used,memory.free,utilization.gpu --format=csv,noheader,nounits(or platform equivalent) to detect GPUs. Also runnvidia-smi --query-compute-apps=gpu_uuid,pid,process_name,used_memory --format=csv,noheader,nounits(ornvidia-smi pmon) for per-process info. - Build a table with the
your choicecolumn initially?for every row. - Append the table to the file and show it inline.
- STOP and ASK the user which GPUs to use. Do NOT pick devices yourself. Do NOT default to "all GPUs". Do NOT default to GPU 0. Do NOT proceed without an explicit answer.
- After the user replies, append
Table N+1withyour choicefilled in (✓selected,—skipped) and the resultingCUDA_VISIBLE_DEVICES=...string in the caption update. - Only then signal that downstream work (e.g.,
exp-tracking) may proceed with the agreed device list.
If nvidia-smi fails or returns no devices (no GPU, no driver, remote machine without access): say so explicitly, append a one-row table with status n/a — no GPU detected, and ASK whether to proceed CPU-only. Do not silently switch.
Caption Contract
- Pre-flight goal — what is about to run on the GPU(s)?
- Scope — single-node? multi-node? specific exp name?
- Acceptance — what counts as a usable GPU (free VRAM threshold, util threshold, etc.)?
- Update (for
Table Nwhere N>1) — what changed since the last check, AND the user's confirmed selection if applicable (e.g., "User selected GPU 0,2,4,5; CUDA_VISIBLE_DEVICES=0,2,4,5").
Format: **Table N.** <pre-flight goal> Scope: <scope>. Acceptance: <usable-GPU criterion>. Update: <delta and/or selection>.
Table Schema
| id | index | name | total VRAM | used VRAM | free VRAM | util% | processes | recommendation | your choice |
|----|-------|------|------------|-----------|-----------|-------|-----------|----------------|-------------|
| G0 | 0 | NVIDIA A100-SXM4-80GB | 80 GB | 2 GB | 78 GB | 0% | — | free | ? |
| G1 | 1 | NVIDIA A100-SXM4-80GB | 80 GB | 60 GB | 20 GB | 87% | [pid 12345 colleague-job](./logs/g1-other.log) | busy | ? |id— stable id (G0..Gk).index— the literal CUDA device index used inCUDA_VISIBLE_DEVICES.name— GPU model from nvidia-smi.total VRAM/used VRAM/free VRAM— in GB, two significant digits or rounded as appropriate.util%— current utilization percent.processes— list of[pid <pid> <command>](./path/to/log)for each process taking VRAM. Pid alone is not enough — surface the command so the user knows whose job it is. Empty:—.recommendation— one offree(used <5% of VRAM, util ≈0%),partial(some headroom but other jobs running),busy(low headroom or high util),unknown.your choice—?until the user confirms; then✓or—(skipped) in the next appended table.- Empty cells:
—. Never blank.
Interaction Flow
- Detect. Run
nvidia-smi. If it fails, surface the failure in a one-row table withstatus=n/a — no GPU detectedand ask whether to proceed CPU-only. - Build
Table 1. One row per detected GPU. Recommendation column populated.your choicecolumn =?for all rows. - Append the file at
./experiments/<name>-gpu-plan.md(or./gpu-plan.md). - STOP and ASK. Show the table inline AND a clear question: "Which GPUs should this run use? Reply with indices (e.g.,
0,2,4,5),all, orabort." - WAIT. Do NOT proceed with any GPU work, do NOT issue any CUDA call, do NOT start
exp-tracking, until the user replies with a specific selection. - Confirm. When the user replies, append
Table N+1withyour choicecolumn filled in. The caption update names the selection and the resultingCUDA_VISIBLE_DEVICES=...string. - Hand-off. Only after the confirmation table is appended may downstream tools launch jobs. Pass the selected indices forward (e.g., to
exp-tracking).
Worked Example
The file ./experiments/lr-sweep-gpu-plan.md after one user confirmation contains both tables:
Table 1. Pre-flight GPU check before launching
lr-sweepruns R1-R4 — Scope: single 8-GPU nodegpu-host-01. Acceptance: ≥40 GB free VRAM and util ≤10% counts asfree. Update: initial check.
id index name total VRAM used VRAM free VRAM util% processes recommendation your choice G0 0 A100-SXM4-80GB 80 GB 2 GB 78 GB 0% — free ? G1 1 A100-SXM4-80GB 80 GB 60 GB 20 GB 87% pid 12345 train.py busy ? G2 2 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free ? G3 3 A100-SXM4-80GB 80 GB 78 GB 2 GB 95% pid 67890 finetune.sh busy ? G4 4 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free ? G5 5 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free ? G6 6 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free ? G7 7 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free ? STOP — waiting for user to pick GPUs. Reply with indices (e.g.,
0,2,4,5),all, orabort.
User: "use 0, 2, 4, 5"
Table 2. Pre-flight GPU check before launching
lr-sweepruns R1-R4 — Scope: single 8-GPU nodegpu-host-01. Acceptance: ≥40 GB free VRAM and util ≤10%. Update: user selected indices 0,2,4,5;CUDA_VISIBLE_DEVICES=0,2,4,5.
id index name total VRAM used VRAM free VRAM util% processes recommendation your choice G0 0 A100-SXM4-80GB 80 GB 2 GB 78 GB 0% — free ✓ G1 1 A100-SXM4-80GB 80 GB 60 GB 20 GB 87% pid 12345 train.py busy — G2 2 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free ✓ G3 3 A100-SXM4-80GB 80 GB 78 GB 2 GB 95% pid 67890 finetune.sh busy — G4 4 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free ✓ G5 5 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free ✓ G6 6 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free — G7 7 A100-SXM4-80GB 80 GB 1 GB 79 GB 0% — free —
In chat after the second update, show only Table 2. Now downstream skills (e.g., exp-tracking) may launch with CUDA_VISIBLE_DEVICES=0,2,4,5.
Common Mistakes
| Thought | Reality |
| "I'll just default to GPU 0." | NEVER pick GPUs without explicit user confirmation. Other people may be using GPU 0. |
| "All GPUs look free, I'll grab them all." | Still ASK first. The user may want to leave headroom for someone else. |
"nvidia-smi is taking time, I'll start the job and check after." | No. Pre-flight comes BEFORE compute, not after. A wrong allocation costs hours and wrecks someone else's run. |
"User said lr-sweep, obviously they want all 8 GPUs." | The user said lr-sweep. They did NOT say which GPUs. Ask. |
| "I'll narrate which GPUs are free in chat" | A narration is not a confirmation. Append the table, ask, wait. |
| "Skip the file for a quick check" | The file is the audit trail of which GPUs you committed to using when. Append it. |
| "I'll overwrite Table 1 with the user's selection" | Append Table 2. The trajectory IS the value (which GPUs were available, which were chosen). |
"User said all — no need to record" | Even all is an explicit confirmation that gets recorded in Table N+1 with all ✓. |
| "Process column with just pids is fine" | Pids alone don't tell the user whose job is on the GPU. Include the command, link to a log if known. |
"No nvidia-smi, must be a CPU-only machine — just run on CPU" | If GPU work was intended and no GPU is detected, ASK before falling back to CPU. |
Red Flags — STOP
| Thought | Reality |
"I'll start training with CUDA_VISIBLE_DEVICES=all and see what happens." | STOP. Run gpu-manage first. Confirm with user. |
| "The user is in a hurry, I'll skip the GPU check." | The fastest path is the safe path. A user-confirmed selection costs ~10 seconds. A wrong allocation costs hours. |
"exp-tracking already started, I'll back-fill the GPU plan after." | gpu-manage is a HARD gate BEFORE exp-tracking. No retroactive plans. |
| "GPU 1 is busy with someone's job — I'll just use the rest, no need to ask." | ASK. The user may want to wait, may have priority, may want to coordinate with the other user. |
| "I'll skip writing the file since it's just a one-time check" | Every check is recorded. Future you / another reader will want the audit trail. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

