Partition
Use this skill when the user asks to choose, rank, compare, or change Slurm partitions for job scripts on the Berkeley cluster.
Core Workflow
- Query current Slurm data before deciding. Partition availability changes.
- Rank partitions using current availability, physical max memory, CPU count, GPU presence, account/QOS association, and benchmark suitability.
- For given
.shjob files, read their#SBATCH --memrequest and choose a partition whose physical max memory is strictly larger than the request. - Edit only these SBATCH fields unless the user explicitly asks otherwise:
--partition,--account,--qos. - Do not change
--mem. If no ranked partition can satisfy the existing memory request, stop and explain the blocker. - After edits, print one representative modified
.shfile or at least its SBATCH header so the user can verify the change.
Helper Script
Prefer the bundled helper for ranking and edits:
python3 /global/home/users/yaoshen/.codex/skills/partition/scripts/partition_helper.py rank
python3 /global/home/users/yaoshen/.codex/skills/partition/scripts/partition_helper.py update path/to/job.sh
python3 /global/home/users/yaoshen/.codex/skills/partition/scripts/partition_helper.py update --apply path/to/job1.sh path/to/job2.sh
update defaults to dry-run. Use --apply only when the user asked for file
edits. The helper prints the selected partition/account/QOS and an example
header. It queries Slurm with sacctmgr, sinfo, and scontrol; if sandboxing
blocks Slurm sockets, rerun with escalated permissions.
Common options:
--cpu-only Prefer CPU partitions and penalize GPU partitions.
--allow-gpu Permit GPU partitions in the ranking.
--include-interactive Permit ood_inter.
--prefer PARTITION Add a ranking bonus to one partition.
--partition PARTITION Force a partition if it fits the existing --mem.
--show-lines N Print N lines from the example script.
Local Policy
For routine CPU-only WB97M(OS) or Q-Chem benchmarks, prefer CPU partitions over GPU partitions. Current practical defaults are usually:
cm1,account=lr_qchem,qos=condo_qchemlr8,account=lr_mhg2,qos=mhg2_lr8_normalmhg,account=mhg,qos=normallr6,account=lr_mhg2,qos=lr_lowpriolr7,account=lr_mhg2,qos=condo_mhg_lr7by default; use another lr7 QOS only when explicitly requested by the user
Use lr_bigmem only when the existing memory request is above normal CPU-node
capacity. Avoid ood_inter for production benchmark batches unless the user
explicitly asks for interactive work.
Manual Editing Rules
If editing without the helper, preserve all unrelated lines and comments. Modify or insert exactly these lines near the top SBATCH block:
#SBATCH --partition=<partition>
#SBATCH --account=<account>
#SBATCH --qos=<qos>
Validate after editing with:
rg -n '^#SBATCH --(partition|account|qos|mem)=' path/to/job.sh
sed -n '1,40p' path/to/job.sh