HPC Runtime Doctor
Goal
Turn cluster symptoms into a resource-layout diagnosis, environment checklist, and safe retry plan.
Requirements
- Python 3.10+
- No external dependencies
- Works on Linux, macOS, and Windows
Inputs to Gather
| Input |
Description |
Example |
| Scheduler |
SLURM, PBS, LSF, local |
slurm |
| Nodes/tasks/threads |
Runtime layout |
2 nodes, 128 tasks, 2 threads |
| GPUs |
Total (whole-job) GPUs via --gpus, or per node via --gpus-per-node |
--gpus 4 or --gpus-per-node 1 |
| Symptoms |
Observed failure |
oom,killed,slow-gpu |
| MPI/OpenMP/GPU use |
Parallel modes |
mpi+openmp+gpu |
| Walltime |
Requested time |
12:00:00 |
| Scratch |
Whether scratch is used |
true |
Decision Guidance
- Check resource layout before changing physics settings.
- Confirm module/compiler/MPI/CUDA consistency before debugging solver behavior.
- Treat missing restart files and scratch cleanup as workflow failures, not physics failures.
- For GPU jobs, confirm the executable was built with the requested accelerator backend.
Script Outputs
scripts/hpc_runtime_doctor.py emits:
resource_layout (includes tasks_per_node, total_cpus, total gpus, and gpus_per_node)
diagnoses
environment_checks
retry_plan
scheduler_notes
warnings (layout flags such as ranks-per-GPU oversubscription, OpenMP/thread mismatch, and uneven task placement)
In default (non-JSON) mode the script also prints the resource-layout summary, any
warnings, environment checks, and retry plan, so the most actionable items are never hidden.
Workflow
--gpus is the total (whole-job) GPU count. Use --gpus-per-node (SLURM
--gres=gpu:N semantics) when you know the per-node allocation; total GPUs are then
gpus_per_node * nodes and it overrides --gpus.
python3 skills/hpc-deployment/hpc-runtime-doctor/scripts/hpc_runtime_doctor.py \
--scheduler slurm \
--nodes 2 \
--tasks 128 \
--cpus-per-task 2 \
--gpus 4 \
--symptoms oom,slow-gpu \
--uses-mpi \
--uses-openmp \
--uses-gpu \
--json
The example above shares 128 ranks across 4 GPUs (32 ranks/GPU), so the
warnings list surfaces Many MPI ranks per GPU (32.0 ranks/GPU) may reduce GPU efficiency. The ranks-per-GPU check uses total ranks over total GPUs, so it fires
correctly on multi-node jobs (the threshold is 16 ranks/GPU).
Error Handling
Invalid resource counts stop with exit code 2. Unknown symptoms are preserved as custom items for human review.
Limitations
This skill does not query a live scheduler. It diagnoses from the submitted layout and symptoms.
Security
- Inputs are scalar CLI values and booleans only.
- Resource counts (
--nodes, --tasks, --cpus-per-task, --gpus, --gpus-per-node)
are validated as non-negative finite integers and capped at 1,000,000; out-of-range or
non-integer values exit with code 2.
- The symptoms string is capped at 64 entries of at most 64 characters each;
--walltime
is capped at 32 characters. Oversized input exits with code 2.
- The script does not execute scheduler commands or inspect environment variables.
- The skill uses
Bash only to run its bundled script.
References
- See
references/hpc_runtime_patterns.md for scheduler and runtime diagnosis patterns.
Version History
- 1.1.1: Discriminating evals -- each case now pins the script's specific output
(exact ranks-per-GPU warning, diagnosis categories, resource-layout fields) via
deterministic
script_checks.
- 1.1.0: Unit-consistent ranks-per-GPU warning (total ranks / total GPUs), new
--gpus-per-node argument, integer tasks_per_node with an uneven-placement warning,
full human-readable (non-JSON) output, and input caps for resource counts, symptoms,
and walltime.
- 1.0.0: Initial HPC runtime diagnosis skill.
Source: HeshamFS/materials-simulation-skills — distributed by TomeVault.
1---2name: heshamfs-materials-simulation-skills-materials-simulation-sk3description: HPC Runtime Doctor4---56# HPC Runtime Doctor78## Goal910Turn cluster symptoms into a resource-layout diagnosis, environment checklist, and safe retry plan.1112## Requirements1314- Python 3.10+15- No external dependencies16- Works on Linux, macOS, and Windows1718## Inputs to Gather1920| Input | Description | Example |21|-------|-------------|---------|22| Scheduler | SLURM, PBS, LSF, local | `slurm` |23| Nodes/tasks/threads | Runtime layout | `2 nodes, 128 tasks, 2 threads` |24| GPUs | Total (whole-job) GPUs via `--gpus`, or per node via `--gpus-per-node` | `--gpus 4` or `--gpus-per-node 1` |25| Symptoms | Observed failure | `oom,killed,slow-gpu` |26| MPI/OpenMP/GPU use | Parallel modes | `mpi+openmp+gpu` |27| Walltime | Requested time | `12:00:00` |28| Scratch | Whether scratch is used | `true` |2930## Decision Guidance3132- Check resource layout before changing physics settings.33- Confirm module/compiler/MPI/CUDA consistency before debugging solver behavior.34- Treat missing restart files and scratch cleanup as workflow failures, not physics failures.35- For GPU jobs, confirm the executable was built with the requested accelerator backend.3637## Script Outputs3839`scripts/hpc_runtime_doctor.py` emits:4041- `resource_layout` (includes `tasks_per_node`, `total_cpus`, total `gpus`, and `gpus_per_node`)42- `diagnoses`43- `environment_checks`44- `retry_plan`45- `scheduler_notes`46- `warnings` (layout flags such as ranks-per-GPU oversubscription, OpenMP/thread mismatch, and uneven task placement)4748In default (non-JSON) mode the script also prints the resource-layout summary, any49`warnings`, environment checks, and retry plan, so the most actionable items are never hidden.5051## Workflow5253`--gpus` is the **total** (whole-job) GPU count. Use `--gpus-per-node` (SLURM54`--gres=gpu:N` semantics) when you know the per-node allocation; total GPUs are then55`gpus_per_node * nodes` and it overrides `--gpus`.5657```bash58python3 skills/hpc-deployment/hpc-runtime-doctor/scripts/hpc_runtime_doctor.py \59 --scheduler slurm \60 --nodes 2 \61 --tasks 128 \62 --cpus-per-task 2 \63 --gpus 4 \64 --symptoms oom,slow-gpu \65 --uses-mpi \66 --uses-openmp \67 --uses-gpu \68 --json69```7071The example above shares 128 ranks across 4 GPUs (32 ranks/GPU), so the72`warnings` list surfaces `Many MPI ranks per GPU (32.0 ranks/GPU) may reduce GPU73efficiency.` The ranks-per-GPU check uses total ranks over total GPUs, so it fires74correctly on multi-node jobs (the threshold is 16 ranks/GPU).7576## Error Handling7778Invalid resource counts stop with exit code 2. Unknown symptoms are preserved as custom items for human review.7980## Limitations8182This skill does not query a live scheduler. It diagnoses from the submitted layout and symptoms.8384## Security8586- Inputs are scalar CLI values and booleans only.87- Resource counts (`--nodes`, `--tasks`, `--cpus-per-task`, `--gpus`, `--gpus-per-node`)88 are validated as non-negative finite integers and capped at 1,000,000; out-of-range or89 non-integer values exit with code 2.90- The symptoms string is capped at 64 entries of at most 64 characters each; `--walltime`91 is capped at 32 characters. Oversized input exits with code 2.92- The script does not execute scheduler commands or inspect environment variables.93- The skill uses `Bash` only to run its bundled script.9495## References9697- See `references/hpc_runtime_patterns.md` for scheduler and runtime diagnosis patterns.9899## Version History100101- 1.1.1: Discriminating evals -- each case now pins the script's specific output102 (exact ranks-per-GPU warning, diagnosis categories, resource-layout fields) via103 deterministic `script_checks`.104- 1.1.0: Unit-consistent ranks-per-GPU warning (total ranks / total GPUs), new105 `--gpus-per-node` argument, integer `tasks_per_node` with an uneven-placement warning,106 full human-readable (non-JSON) output, and input caps for resource counts, symptoms,107 and walltime.108- 1.0.0: Initial HPC runtime diagnosis skill.109110---111> Source: [HeshamFS/materials-simulation-skills](https://github.com/HeshamFS/materials-simulation-skills) — distributed by [TomeVault](https://tomevault.io).112<!-- tomevault:4.0:skill_md:2026-06-24 -->