Use when working on a Digital Research Alliance of Canada (DRAC, Alliance, formerly Compute Canada) HPC cluster such as Narval, Rorqual, Fir, TamIA, Killarney, Vulcan, Nibi or Trillium, or on any shared academic Slurm cluster with MFA logins, shared login nodes and /home, /project, /scratch quotas — including ssh failing with "Permission denied (keyboard-interactive)" (an expired ControlMaster, not an outage), deciding whether something may run on a login node, sinfo/sacctmgr "command not fou...
7 stars
0 votes
0 copies
3 views
Added September 5, 2026
researchpythongoshellbashnodetestinggit
Works with
terminal
cli
Security analysis
B75/100
criticalAccesses sensitive system or user directories
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Using Drac Clusters?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/chgagne-using-drac-clusters)
---
name: using-drac-clusters
description: Use when working on a Digital Research Alliance of Canada (DRAC, Alliance, formerly Compute Canada) HPC cluster such as Narval, Rorqual, Fir, TamIA, Killarney, Vulcan, Nibi or Trillium, or on any shared academic Slurm cluster with MFA logins, shared login nodes and /home, /project, /scratch quotas — including ssh failing with "Permission denied (keyboard-interactive)" (an expired ControlMaster, not an outage), deciding whether something may run on a login node, sinfo/sacctmgr "command not found" over ssh, submitting or monitoring Slurm jobs (sbatch, squeue, sacct, job arrays, GPU allocations), choosing between clusters, staging data into /project or /scratch, transfers or writes that hang, or jobs stuck PENDING.
---
# Using DRAC Clusters
## Overview
DRAC clusters are shared, MFA-gated, quota-bound Slurm systems. Three properties
drive almost every mistake: **you cannot authenticate on your own**, **login
nodes are not for computing**, and **almost nothing is knowable without asking
the cluster** — accounts, partitions, GPU types and quotas differ per cluster.
**Core principle: discover, don't assume.** Every value below has a command that prints
the truth; run it once per cluster and cache it in the project's notes.
**Scope: this skill is the mechanics** (authentication, accounts, gres, quotas, files).
For campaign *methodology* (walltime budgets, job shape, staging) use `running-cluster-experiments`.
## The MFA gate — read this before anything else
**MFA is mandatory on DRAC and an agent cannot complete it.** Non-interactive ssh
works *only* by multiplexing over a ControlMaster socket the user already
authenticated. Before concluding the cluster is down:
```bash
ssh -O check <cluster> # "Master running (pid=...)" = usable
```
With no live master, **every** command fails with `Permission denied (keyboard-interactive)`:
not a transient error, a wrong key, or an outage. Retrying cannot fix it.
**Do NOT engineer around the MFA prompt** (e.g. an `SSH_ASKPASS` script that auto-selects
the push): it makes the user's phone a rubber stamp, an MFA-fatigue attack shape. Why, and
how it happened in testing: `reference/mfa-askpass.md`.
**The gate is a stop, not an obstacle.** Report the blocker and ask. Automating the
prompt is the user's explicit call, never yours to assume.
### Two legitimate ways to open the master
**A. The user opens it in a REAL terminal.** An agent-run shell cannot (`!` prefix,
tool call, `nohup`, background job): no TTY, so ssh fails with
`ssh_askpass: exec(/usr/X11R6/bin/ssh-askpass): No such file or directory`.
So the ask is specific: *"open Terminal/iTerm and run `ssh <cluster>`, complete
the MFA prompt."* They may exit immediately afterwards — `ControlPersist` keeps
the master alive once it exists.
**B. A GUI askpass, if the user has installed one** (`SSH_ASKPASS` pointing at a real
dialog program, `DISPLAY` set): the agent starts the connection, the *user* answers.
**The distinction is who answers:** a dialog program ASKS the human (fine); a script
returning a canned answer REPLACES them (prohibited).
**With askpass available, ANNOUNCE BEFORE CONNECTING**, so an unannounced dialog stays
a reliable signal to refuse. If asked to install one: do **not** run `brew services start`
(it sets `SSH_ASKPASS` and `SUDO_ASKPASS` globally); export `SSH_ASKPASS` from the profile.
A socket that worked an hour ago proves nothing about now; re-check before a batch of commands.
Per-cluster `~/.ssh/config` that makes this work:
```
Host narval narval.alliancecan.ca
HostName narval.alliancecan.ca
User <username>
ControlMaster auto
ControlPath ~/.ssh/sockets/%r@%h-%p.sock
ControlPersist 8h
```
`mkdir -p ~/.ssh/sockets` first, or multiplexing fails silently and every command re-prompts
for MFA. With no master, `ssh -O check` prints `Control socket connect(...): No such file or directory`.
## Never compute on a login node
Login nodes are for editing, transfers and `sbatch`; staff kill offenders. Cheap
queries (`squeue`, `sinfo`, `sacct`, `diskusage_report`, `ls`) are fine; anything
looping over data, training, or running for minutes is not. Use `sbatch`, or:
```bash
salloc --account=<alloc>_cpu --cpus-per-task=4 --mem=8G --time=1:00:00
```
## Discover the cluster, don't assume it
| What | Command |
|---|---|
| Which cluster am I on | `echo $CC_CLUSTER` |
| **Accounts you may charge** | `sacctmgr -n show assoc user=$USER format=Account%30 \| sort -u` |
| Partitions and their time caps | `sinfo -h -o "%P %l" \| sort -u` |
| GPU models actually present | `sinfo -h -o "%G" \| sort -u` |
| Quotas (space **and file count**) | `diskusage_report` |
| Your fairshare / why you are queued | `sshare -U -u $USER -o Account,RawUsage,LevelFS` |
| Job efficiency after it finishes | `seff <jobid>` (absent on some clusters — fall back to `sacct -j <id> -o Elapsed,MaxRSS,TotalCPU`) |
Six clusters measured side by side, and why each rule below exists: `reference/cluster-differences.md`.
- **Max walltime differs:** some clusters have `b6` at 28 days (CPU), AI clusters may stop at `b3` (24h). **Always read `sinfo -h -o "%P %l"`.**
- **Partitions are not always `bygpu`/`bynode`:** some name them by GPU model (`gpubase_h100_b3`); there you select hardware by partition.
- **Some clusters have no CPU partitions:** stage CPU-only work on another cluster.
- **Fractional GPUs:** MIG slices (`_1g.`/`_3g.`) are partitions of a card; **`shard:`** is a time-shared card, wrong for timing benchmarks.
- **Inode quotas differ by four orders of magnitude** (250K vs 105M); check per cluster.
- **Trillium is different:** whole-node CPU jobs (192 cores), 1 or 4 GPUs only, separate CPU and
GPU login hosts *and Slurm controllers*, 15-min minimum on `compute`. Table: `reference/cluster-differences.md`.
**Some clusters set up Slurm only in a LOGIN shell.** Symptom over `ssh <cluster> 'cmd'`:
`bash: line 1: sinfo: command not found`, with `$CC_CLUSTER`, `$SCRATCH` and `$PROJECT`
empty. The cluster is fine. **Fix: force a login shell.**
```bash
ssh <cluster> 'bash -lc "sinfo -h -o \"%P %l\" | sort -u"'
```
**Never conclude an account is unprovisioned from `command not found`.** Retry via
`bash -lc` first and note per cluster whether it is needed (job wrappers too). An
empty `$SCRATCH` is especially dangerous: `"$SCRATCH/data"` silently becomes `/data`.
**Accounts often but NOT always carry a resource suffix** (`<alloc>_cpu`/`_gpu`; `aip-` has none).
Always run `sacctmgr`; never copy an account string between projects *or clusters*.
**Never construct user paths — use `$HOME` and `$SCRATCH`.** Some clusters shard both
by first letter (`/home/<u>/$USER`). `$PROJECT` is unset or, on Trillium, a placeholder
path; get the project path from `diskusage_report`, `ls /project/` or `~/links/projects/`.
**GPU gres strings are NOT consistent across clusters — always read them from `sinfo -h -o "%G"`.**
A copied `--gpus=` string fails; a MIG slice gives a sliver of a card. Ask for a whole GPU explicitly.
**Time buckets decide your queue:** `_b1` ≤3h, `_b2` ≤12h, `_b3` ≤24h, `_b4` ≤3d,
`_b5` ≤7d. **Round `--time` down into a bucket.** Where buckets stop at `b3`, a 48h job
is impossible, not slow; checkpoint and requeue. `sinfo -h -o "%P %l"` is authoritative.
## Filesystems: file COUNT is the quota that bites
`/home`: code, small, backed up. `/project`: shared, backed up, **file-count quota
(~500K)**. `/scratch`: large, **not backed up, purged** (~60 days). Put re-fetchable
and high-file-count data on `/scratch`. **On some clusters (Trillium) `/home` and `/project` are
read-only inside jobs**: write outputs and checkpoints to `$SCRATCH`. Details: `reference/cluster-differences.md`.
**Copying into `/project` must preserve group ownership:**
```bash
rsync -a --no-g --no-p --stats src/ <cluster>:/project/<group>/<user>/<proj>/src/
```
Without `--no-g --no-p` collaborators get locked out, silently. Verify after every transfer
(use `--stats`, not `--info=stats1`):
```bash
ssh <cluster> "cd <projdir> && find . -type f ! -group <group> | wc -l" # must print 0
```
## Submitting and monitoring
**Calibrate before submitting an array:** time ONE task, then set `--time` with headroom.
```bash
squeue -u $USER -o '%.14i %.22j %.8T %.10M %.10l %R' # %R = why it is PENDING
sacct -X -S <YYYY-MM-DD> -o JobID%16,JobName%22,State,Elapsed,ExitCode
sacct -j <id> -X -n -o State | sort | uniq -c # array state histogram
```
`-X` gives one row per job instead of per job step.
**Never pipe a running job's output through `tail`, `head` or `grep`** (they buffer); redirect to a file.
**One failed task in a healthy array is usually a bad node:** resubmit it with `sbatch --array=<n> <script>`.
## Monitoring jobs across clusters: dracmon
`assets/dracmon.py`: view-only monitor of queue, progress, usage, storage and state across
clusters. Use it instead of re-running `squeue` by hand on each cluster.
```bash
uv run --script <skill>/assets/dracmon.py # interactive monitor
uv run --script <skill>/assets/dracmon.py doctor # check the setup
uv run --script <skill>/assets/dracmon.py install-launcher # optional: a `dracmon` command in ~/bin
```
**Offer it, then remind now and then.** If the user works on DRAC jobs and `command -v dracmon`
finds nothing, offer it in one or two lines and ask before installing (it writes outside the
project): `uv run --script …`, `install-launcher` (add its PATH line only with consent), or
`dracmon service install` (background collector); then `dracmon doctor`. If declined, not again
this session; later sessions at most one line each; stop if they say no. Full wording:
`reference/shortened-passages.md`.
Progress inside a job, per unit of work (the hook never fails a job):
```bash
dracmon-cell plan 12 # once, at the start of the campaign
dracmon-cell start "seed3"
python train.py --seed 3 && dracmon-cell done "seed3" || dracmon-cell fail "seed3"
# Python: import dracmon_cell as dc; with dc.cell("seed3"): ...
```
**It never answers MFA:** it only reuses sockets you opened. Details: `assets/README-dracmon.md`.
## Common mistakes
- Retrying ssh after `Permission denied (keyboard-interactive)`: cannot succeed; user must redo MFA
- Asking the user to authenticate via an agent-run shell: no TTY; it must be a real terminal
- Assuming a working socket stays working: re-check with `ssh -O check`
- Copying an account, `--gpus=` or `--partition=` string between clusters: rejected or wrong hardware
- Requesting `shard:` thinking it is a whole GPU: time-shared card, meaningless timings
- Concluding an account is unprovisioned from `sinfo: command not found`: retry via `bash -lc`
- Building a path from an empty `$SCRATCH`: `"$SCRATCH/data"` becomes `/data`
- Assuming `b5`/7d is the longest bucket: some clusters have `b6` at 28 days
- Assuming every cluster has CPU partitions: GPU-only clusters reject CPU work
- Assuming `--time=48:00:00` will just queue slowly: unsubmittable on a `b3`-capped cluster
- Hardcoding `/home/$USER`: wrong on sharded homes; use `$HOME`
- Writing checkpoints to `$HOME` or `/project` from a Trillium job: read-only there, the job dies
- `--time` just over a bucket boundary: scarcer partition, far longer queue
- `rsync` into `/project` without `--no-g --no-p`: collaborators locked out
- Judging `/project` headroom by disk space: the file-count quota hits first
- Leaving output on `/scratch`: purged, not backed up
- Submitting a large array on a guessed walltime: dies near completion
- Piping a running job's log through `tail`: buffered, zero visibility
- Keeping a terminal open only to keep a socket alive: dracmon and `ssh -O check` cover it
## Red flags — stop and check
- About to script `SSH_ASKPASS` or auto-answer an MFA prompt → **stop and ask**
- About to run anything longer than a few seconds over ssh → that is a login node
- About to say the cluster is down → run `ssh -O check` first
- About to call an account unprovisioned because Slurm commands are missing → retry through `bash -lc`
- About to reuse a partition name, bucket ceiling or gres string from another cluster → read `sinfo` on THIS one
- About to submit >20 tasks without having timed one → calibrate
- About to report a job's progress from a buffered pipe → you are reading nothing
Measured (S3, `_evals/process-skills/`): this ~220-line text vs the earlier 392-line one, pooled with the other process skills within margin (105 vs 111/126). A stuck-rsync gap seen in S3 (6/12 vs 11/12) did not reproduce in S4 (this text 12/12, the earlier text 10/12, 2026-11-28): noise.