GPU and resource operations
Use this skill for local, read-only GPU inspection and selection before an
experiment. It covers NVIDIA visibility, memory-based availability, the
reserve_last policy, and the optional keep-alive's safety contract. It does
not launch training, reserve a device through a scheduler, or start a keeper
implicitly.
Safety contract
- Begin with the bundled
scripts/gpu_status.py; it only invokes
nvidia-smi queries and never allocates CUDA memory.
- Treat an absent, timed-out, or failed
nvidia-smi query as no usable GPU.
Never infer free devices from configuration, PyTorch importability, or a
missing status result.
- “Free” means reported
memory_used_mb < 1000 by default, not that a device is
exclusively reserved. Confirm ownership before launching work.
reserve_last=true is a selection policy for a keep-alive slot, not a lock.
With one detected GPU it remains usable; with two or more, the highest listed
index is excluded from experiment candidates.
- Do not run the keep-alive during inspection. It allocates a CUDA tensor and
performs repeated operations, so it is an explicit side effect requiring
user approval.
Operating flow
- Run
python scripts/gpu_status.py --help if the interface is unfamiliar;
help must not probe hardware.
- Run
python scripts/gpu_status.py (or add --json for machine-readable
output). Record the status reason when no GPU is reported.
- Select only from
usable_gpus and then filter to free_gpus. Keep the
reserved device out of training when the default policy excludes it.
- If the user explicitly chooses a device, report its
gpu_id, name, memory,
utilization, and temperature before passing its ID to the experiment
launcher. Local launchers express this as CUDA_VISIBLE_DEVICES.
- Before CUDA work, verify both a working NVIDIA driver (
nvidia-smi) and a
PyTorch build for which torch.cuda.is_available() is true. A Python
package alone is not proof of CUDA support.
- For SSH/Slurm status, scheduler allocation, or transport details, route to
execution-and-monitoring. For loop launch and experiment lifecycle, route
to autonomous-experiments. For installing external skills, route to
skills-and-installation.
Bundled references
- GPU status and selection — exact detector
signatures, output shapes, query fields, thresholds, and edge cases.
- Keep-alive contract — explicit side effects,
PyTorch/CUDA prerequisites, interval, signals, cleanup, and invocation
rules.
- Troubleshooting — predictable driver,
CUDA, parsing, selection, and keeper failures.
Output contract
A normal report should include:
detected: whether a complete local NVIDIA status was obtained;
- one row per GPU with ID, name, used/total memory in MB, utilization percent,
and temperature in °C;
usable_gpus after reserve_last policy;
free_gpus after the strict 1000-MB default threshold (or the stated
override);
- an explicit
reason when detection/status is unavailable; and
- whether a last device was excluded, without claiming a reservation lock.
When detected is false, both usable and free lists must be empty. Do not
silently substitute Slurm queue occupancy or a remote host's status for local
NVIDIA measurements.
If a report is used to choose a launch mask, preserve the host GPU IDs and the
selection policy in the handoff. Re-run the read-only probe immediately before
a long launch because memory and utilization are live observations, not a
reservation. Never claim that a keeper is active unless its explicit process
and stop/cleanup outcome have been checked.
1---2name: gpu-and-resource-operations3description: "Detect and select local NVIDIA GPUs, report their resource status, and explain the explicitly opt-in GPU keep-alive without hiding hardware or CUDA limitations."4disable-model-invocation: true5metadata:6 source: https://skillmd.com/skills/vectorspacelab/gpu-and-resource-operations7 disco-role: operating8license: Apache 2.09---1011# GPU and resource operations1213Use this skill for **local, read-only GPU inspection and selection** before an14experiment. It covers NVIDIA visibility, memory-based availability, the15`reserve_last` policy, and the optional keep-alive's safety contract. It does16not launch training, reserve a device through a scheduler, or start a keeper17implicitly.1819## Safety contract2021- Begin with the bundled `scripts/gpu_status.py`; it only invokes22 `nvidia-smi` queries and never allocates CUDA memory.23- Treat an absent, timed-out, or failed `nvidia-smi` query as **no usable GPU**.24 Never infer free devices from configuration, PyTorch importability, or a25 missing status result.26- “Free” means reported `memory_used_mb < 1000` by default, not that a device is27 exclusively reserved. Confirm ownership before launching work.28- `reserve_last=true` is a selection policy for a keep-alive slot, not a lock.29 With one detected GPU it remains usable; with two or more, the highest listed30 index is excluded from experiment candidates.31- Do not run the keep-alive during inspection. It allocates a CUDA tensor and32 performs repeated operations, so it is an explicit side effect requiring33 user approval.3435## Operating flow36371. Run `python scripts/gpu_status.py --help` if the interface is unfamiliar;38 help must not probe hardware.392. Run `python scripts/gpu_status.py` (or add `--json` for machine-readable40 output). Record the status reason when no GPU is reported.413. Select only from `usable_gpus` and then filter to `free_gpus`. Keep the42 reserved device out of training when the default policy excludes it.434. If the user explicitly chooses a device, report its `gpu_id`, name, memory,44 utilization, and temperature before passing its ID to the experiment45 launcher. Local launchers express this as `CUDA_VISIBLE_DEVICES`.465. Before CUDA work, verify both a working NVIDIA driver (`nvidia-smi`) and a47 PyTorch build for which `torch.cuda.is_available()` is true. A Python48 package alone is not proof of CUDA support.496. For SSH/Slurm status, scheduler allocation, or transport details, route to50 `execution-and-monitoring`. For loop launch and experiment lifecycle, route51 to `autonomous-experiments`. For installing external skills, route to52 `skills-and-installation`.5354## Bundled references5556- [GPU status and selection](references/gpu-status.md) — exact detector57 signatures, output shapes, query fields, thresholds, and edge cases.58- [Keep-alive contract](references/keeper.md) — explicit side effects,59 PyTorch/CUDA prerequisites, interval, signals, cleanup, and invocation60 rules.61- [Troubleshooting](references/troubleshooting.md) — predictable driver,62 CUDA, parsing, selection, and keeper failures.6364## Output contract6566A normal report should include:6768- `detected`: whether a complete local NVIDIA status was obtained;69- one row per GPU with ID, name, used/total memory in MB, utilization percent,70 and temperature in °C;71- `usable_gpus` after `reserve_last` policy;72- `free_gpus` after the strict 1000-MB default threshold (or the stated73 override);74- an explicit `reason` when detection/status is unavailable; and75- whether a last device was excluded, without claiming a reservation lock.7677When `detected` is false, both usable and free lists must be empty. Do not78silently substitute Slurm queue occupancy or a remote host's status for local79NVIDIA measurements.8081If a report is used to choose a launch mask, preserve the host GPU IDs and the82selection policy in the handoff. Re-run the read-only probe immediately before83a long launch because memory and utilization are live observations, not a84reservation. Never claim that a keeper is active unless its explicit process85and stop/cleanup outcome have been checked.