一键导入
slurm-job
Create or modify an sbatch job script with correct partitions, accounts, GPU requests, and best-practice defaults for the current cluster.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create or modify an sbatch job script with correct partitions, accounts, GPU requests, and best-practice defaults for the current cluster.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Set up cross-cluster SSH (Great Lakes <-> Lighthouse) and establish the connection. Handles first-time setup automatically.
Experimental. Plan and assist migration of a repository to another lab's compute resources by discovering the current server, user, Slurm/storage environment, and repo assumptions, then presenting findings for correction before editing.
Submit a SLURM experiment with proper naming, documentation, and cross-cluster support. Reads project context to discover submission infrastructure.
Discover completed SLURM experiments, collect results, and update experiment documentation.
Onboard a lab member onto the shared Claude Code and/or Codex configuration. Detects clusters, collects Slurm account details, runs setup, and helps customize personal config.
Onboard a new lab member onto the shared Claude Code configuration. Detects clusters, collects Slurm account details, runs setup, and helps customize personal config.
| name | slurm-job |
| description | Create or modify an sbatch job script with correct partitions, accounts, GPU requests, and best-practice defaults for the current cluster. |
| allowed-tools | Bash(sinfo *), Bash(sacctmgr *), Bash(whoami), Bash(hostname *), Bash(cat *), Bash(ls *), Read, Edit, Write, Glob, Grep |
Help the user create a new sbatch job script or modify an existing one. The goal is a correct, ready-to-submit script that follows lab best practices.
If the user points to an existing .sh or .slurm file (or pastes script content), read it and help them modify it. Common requests:
Apply the same best practices described below when modifying.
Ask the user concisely (combine into one question where possible):
If the user already provided some of this info (e.g., "create an sbatch script for training on 2 L40S GPUs"), don't re-ask what's already clear.
Run these commands to determine the correct --account for the chosen partition:
whoami
sacctmgr show association user=$(whoami) format=account%20,partition%20,qos%40 --noheader 2>/dev/null
Mapping:
arph QOS (owned account)normal QOS (general account, typically qmei0 or similar)Use this template as a starting point, adapting to the user's needs:
#!/bin/bash
#SBATCH --job-name=<job_name>
#SBATCH --partition=<partition>
#SBATCH --account=<account>
#SBATCH --gres=gpu:<num_gpus>
#SBATCH --cpus-per-task=<cpus>
#SBATCH --mem=<memory>
#SBATCH --time=<time>
#SBATCH --output=logs/%x_%j.out
#SBATCH --error=logs/%x_%j.err
# --- Setup ---
set -euo pipefail
# Create log directory if needed
mkdir -p logs
# Print job info for debugging
echo "Job ID: $SLURM_JOB_ID"
echo "Node: $(hostname)"
echo "GPUs: $SLURM_GPUS_ON_NODE"
echo "Start: $(date)"
echo "---"
# Activate environment
# module load cuda # uncomment if needed
# conda activate <env_name>
# --- Run ---
<user_command>
echo "---"
echo "End: $(date)"
| GPU | Partition | Mem/GPU | CPUs/GPU |
|---|---|---|---|
| L40S | spgpu2 | 60G | 4 |
| A40 | spgpu | 40G | 4 |
| V100 | gpu | 20G | 4 |
| A100 MIG | gpu_mig40 | 60G | 4 |
Scale memory and CPUs proportionally for multi-GPU jobs (e.g., 2 L40S → --mem=120G --cpus-per-task=8).
Logs: Always set --output and --error to a logs/ directory (or turbo path for very large/long jobs). Use %x (job name) and %j (job ID) in filenames so logs don't overwrite each other.
set -euo pipefail: Include at the top so failures are caught early.
Job info header: Print SLURM_JOB_ID, hostname, GPU count, and timestamp so the user can debug and correlate logs.
Environment activation: Include a commented-out conda activate or module load line as a reminder. If the user tells you which environment to use, uncomment and fill it in.
Time limit: Always set --time. If the user doesn't specify, suggest a reasonable default and explain they can adjust it. Max is 14 days on most partitions.
No home directory output: If the job writes large outputs (checkpoints, datasets, results), direct them to turbo storage, not ~/.
Scratch for I/O-heavy jobs: If the job reads many small files or does heavy random I/O (e.g., training on large image datasets), stage data to scratch (/scratch/<account>/<project>/<user>/) at job start for better performance, and copy results back to turbo at job end. Include cleanup. Example pattern:
SCRATCH_DIR=/scratch/${SLURM_ACCOUNT}/${USER}/${SLURM_JOB_ID}
mkdir -p "$SCRATCH_DIR"
cp -r /nfs/turbo/si-qmei/${USER}/data "$SCRATCH_DIR/"
# ... run job from $SCRATCH_DIR ...
mkdir -p /nfs/turbo/si-qmei/${USER}/results
cp -r "$SCRATCH_DIR/output" /nfs/turbo/si-qmei/${USER}/results/
rm -rf "$SCRATCH_DIR"
Remind the user that scratch is auto-purged after 60 days of inactivity — never use it as permanent storage.
Multi-node / distributed: If the user requests multiple nodes, add --nodes, --ntasks-per-node, and include torchrun or srun launcher setup as appropriate. Ask the user which distributed framework they use if unclear.
Show the complete script to the user and explain any non-obvious choices. Write it to the requested path (or suggest a sensible default like ./job.sh).
Remind the user:
mkdir -p logs before first submission (or the script does it automatically)sbatch <script_name>.shsqueue -u $(whoami) or sacct -j <job_id>scancel <job_id>Only add these if the user asks or if clearly relevant:
#SBATCH --mail-type=END,FAIL and #SBATCH --mail-user=<email>#SBATCH --array=0-N with $SLURM_ARRAY_TASK_ID usage#SBATCH --dependency=afterok:<job_id>WANDB_PROJECT, WANDB_DIR to turbo, etc.