launch-with-slurm

Dispatch SLURM workloads by wrapping srun inside the current allocation.

327|31|Updated Mar 21, 2026
One-click install
npx skills add https://github.com/mlc-ai/pith-train --skill launch-with-slurm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: launch-with-slurm
Source: https://github.com/mlc-ai/pith-train/tree/main/.agents/skills/launch-with-slurm
Command: npx skills add https://github.com/mlc-ai/pith-train --skill launch-with-slurm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Dispatching work inside a SLURM allocation using srun to efficiently utilize reserved compute on single-node or multi-node clusters.

Core Features & Use Cases

  • Context-aware dispatch: prefer srun over raw torchrun or bash when $SLURM_JOB_ID is set to preserve environment and IO behavior across ranks.
  • Allocation reading: read AllocTRES and NodeList via scontrol to tailor commands to the allocation.
  • Logging and robustness: use -o with --open-mode to capture distributed logs and support resumed runs.
  • Use Case: launching a training job or validation step inside an existing SLURM allocation, possibly across multiple nodes.

Quick Start

Invoke srun with the appropriate flags inside the current SLURM allocation to start your job.

Frequently Asked Questions about launch-with-slurm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I launch a training job inside an existing SLURM allocation from an AI agent?

To launch a training job inside a SLURM allocation, wrap srun to dispatch the workload while preserving environment and IO behavior across ranks. The skill reads allocation context with scontrol and builds an srun command using -N, --nodelist, and -o to execute properly.

When should I use srun instead of raw torchrun for distributed workloads on an HPC cluster?

Use srun instead of raw torchrun when $SLURM_JOB_ID is set to preserve environment and IO behavior across ranks. Using srun ensures context-aware dispatch within the active allocation, properly utilizing reserved compute on single-node or multi-node clusters.

How does scontrol read AllocTRES and NodeList to build srun commands for multi-node clusters?

Scontrol reads AllocTRES and NodeList to tailor srun commands to the specific allocation. This context-aware dispatch ensures the built srun command uses the correct -N flag and --nodelist parameter to target reserved compute resources across multi-node clusters.

Can I launch multi-node workloads across an existing SLURM allocation using this dispatch method?

Yes, you can launch multi-node workloads across existing SLURM allocations. The method applies to both single-node and multi-node allocations, reading the allocation context via scontrol to build appropriate srun commands that target the correct nodes.

How do I capture distributed logs and support resumed runs when dispatching srun jobs?

To capture distributed logs and support resumed runs, use the -o flag combined with --open-mode in the srun command. This enforces proper logging requirements and ensures output is captured correctly for distributed training jobs inside the allocation.

What are the limitations of using srun inside a SLURM allocation for job dispatch?

Using srun inside a SLURM allocation requires an active allocation context with $SLURM_JOB_ID set, and it enforces strict executable requirements. It cannot dispatch work outside of an existing allocation and relies on scontrol to read AllocTRES and NodeList correctly.