Sizing and submitting jobs¶
nomad size says what a job should ask for, and nomad submit sends it with that. People run them themselves, on a cluster's login node: nomad reads their script, the input file it names, their own past jobs from Slurm's accounting, and the cluster's partitions. Nothing is stored, and nothing needs changing in Slurm.
nomad size job.sh what job.sh should ask for
nomad size --job 4815162 a job of yours that ran, to run it again
nomad submit job.sh [ARGS...] size it, show the sbatch command, ask, submit
nomad submit --again 4815162 a job of yours, sent again (an array: 5005, or one task: 5005_7)
nomad submit --mem 12G job.sh your own value for memory (and --cpus, --time, --gpus, --partition)
nomad submit --keep job.sh the script's own values: nomad only checks and tags
A lab's own workstations, with no scheduler, take jobs from the Console's Submit page too (1.67.0): see Jobs on Lab Machines.
Options for nomad submit go before the script, as with sbatch; what follows the script is its arguments (nomad warns, and won't submit without asking, when one of its own options comes after the script). --dry-run shows the command without running it, and --yes submits without asking.
What it shows¶
job.sh: Gaussian (g16), input w.com
compared with your 5 runs of this script
asked nomad why
CPUs 4 8* the input sets 8 threads of one task (%nprocshared=8): 4 CPUs would make them share cores
memory 8G 20G* what the input sets (%mem 16 GB, and a fifth more: Gaussian needs room beyond %mem); your 3 runs of this script peaked at 10.7G
time 04:00:00 02:30:00* the longest of your 3 runs of this script took 01:30:00: a shorter limit starts sooner
GPUs - - none asked
partition basic basic it fits basic
(* nomad would change it)
Memory is per node. Each value says where it comes from:
- The input file or the command line, for programs that state their sizes there:
| Program | CPUs | Memory |
|---|---|---|
| Gaussian | %nprocshared (%nproc, %cpu): threads |
%mem, and a fifth more |
| ORCA | %pal nprocs, ! PALn: processes |
%maxcore × processes, and a quarter more |
| Q-Chem | qchem -nt (threads) or -np (processes) |
MEM_TOTAL in $rem (for each process), and a fifth more |
| Columbus | runc -nproc: processes |
runc -m (for each process), and a fifth more |
| GROMACS | mdrun -nt, or -ntmpi × -ntomp: threads |
— |
| NAMD | +pN: processes under charmrun or mpirun, else threads |
— |
Threads are asked as one task with that many CPUs (--ntasks=1 --cpus-per-task=N), processes as that many tasks of a CPU each (--ntasks=N): a job asking the other way is told so. A value given by a shell variable (-nt $SLURM_CPUS_PER_TASK) is left to the job's own request. The input file is read where the job will run: the folder sbatch is run in (or --chdir), after a literal cd in the script; nomad says when it is only found next to the script.
- How the job ended, for one run again: out of memory, half as much memory again; out of time, half as long again; or what the input says, or your past runs of it needed, or what its script asks now, whichever is more. A job that stopped with an error is sized as usual, with a note that more resources won't fix it; one whose node failed or that was preempted runs as it was.
- Your past runs like this one: the same script; else the same program in the very same folder; else the same job name; else the same program. An interpreter (python, R, Julia, MATLAB) or a program nomad doesn't know isn't "the same program": two python scripts can be anything. Memory is the highest peak × 1.5, time the longest run × 1.5 (the room nomad's scores ask for), rounded to values people type. History may lower a value only from at least three runs that completed, of the same script or of the same program in the same folder; the weaker matches (the same job name, the same program anywhere) may only raise one. A value the job doesn't ask for is weighed against the partition's default (its DefaultTime, else MaxTime; DefMemPerNode or DefMemPerCPU): where that isn't known, only runs close enough to lower a value set one. A run that failed never counts, nor a memory reading larger than its nodes have (Slurm can count memory processes share more than once). CPUs are lowered only as CPUs per task of a one-task job, never as tasks (an MPI launch counts on them), and only from runs that had at least as many CPUs as now asked. Where the runs of this script had other arguments, nomad says so.
- The program: an executable built for GPUs (pmemd.cuda, mdrun -nb gpu) gets one when none is asked.
- The partition: when the one asked (or the default) doesn't fit -- too long for its limit, no node with the CPUs, memory and GPUs one node needs together (a task's GPUs are on its node), too few GPUs in all, or one the job's account may not use (its AllowGroups, AllowAccounts; the job's --account, else the person's default account) -- nomad names one that fits, preferring ones the person may use, not preemptible, with the smallest nodes. A partition Slurm doesn't list is kept (Slurm checks it), and one whose nodes couldn't be read isn't offered. With a list (-p a,b), Slurm picks; nomad checks that one of them fits. A time or memory nomad works out that the partition can't give is asked at what it gives (its time limit, its biggest node), with a note.
A job on several nodes (--nodes above 1) keeps its CPUs and memory; nomad checks its time and partition. Tasks Slurm places over as many nodes as it takes (--ntasks without --nodes), or on several, with memory per CPU or per GPU have no one node's figure: their memory is weighed a CPU (or GPU) at a time, and shown so (2G/CPU) -- the input's memory over the CPUs the job will have, or, when the job ran out, half as much again a CPU from Slurm's record (never below what the script asks now); past runs' readings (a node at a time) aren't weighed, a change of their CPUs keeps memory per CPU, and a partition fits them when its nodes hold them all, a task (its CPUs and their memory) at a time. --ntasks-per-node alone (no --ntasks, no --nodes) is that many tasks on one node; with --ntasks, it is the most a node takes. CPUs asked per GPU (--cpus-per-gpu) or through --tres-per-task=cpu=N are kept, and so is no time limit (--time=UNLIMITED, 0 or -1; nomad says when a partition has a limit).
nomad never changes how a job asks: memory asked per CPU or per GPU stays so (rounded up to 64 MB, or down to whole megabytes when it is a node's memory: sbatch takes no fractions), GPUs stay --gpus, --gpus-per-node, --gpus-per-task, --tres-per-task or --gres, with their type and the job's other gres. Memory is decided per node: when CPUs or GPUs change (nomad's or yours), memory asked per CPU or per GPU is written again for them, so the node gets the memory the table shows. #SBATCH lines (and #SLURM, #SBATCH--x) are read as sbatch reads them: at the very start of a line (an indented one is a comment), before the first command.
Submitting¶
nomad submit shows the same table, then the exact sbatch command, and asks. Only the values that change are set on the command line (sbatch reads the rest from the script's #SBATCH lines), and what is sent is checked again: a value you give that no node can hold is said before you submit. sbatch runs in the folder you run nomad in, as it would by hand (a relative --chdir in the script is its own). --cpus sets CPUs the way the script asks them (CPUs per task for one task, else tasks; tasks of several CPUs each keep their CPUs per task: a multiple of them; tasks per node stay per node: a multiple of the nodes); --gpus too (per task or per node, --gres on several nodes included: a multiple of the tasks or nodes; --gpus on several nodes: at least one a node). nomad can't take an option away: --gpus 0 on a script that asks for GPUs says to remove its line. --mem is per node (0: all of a node's memory), so it isn't taken for tasks Slurm places over its nodes with memory per CPU or per GPU: change that in the script. What the job doesn't ask (time, memory) is weighed against the defaults of the partition it goes to, yours included.
A job sent again gets its own command line's other options and its folder (--chdir), and runs its script as it is on disk now (nomad says when it changed since). Slurm keeps the folder the job ran in, not the one sbatch ran in: a script that moves itself (#SBATCH --chdir) is found in the folder its --chdir leads from. Not sent again: its --dependency (on jobs long gone; singleton is kept), --begin and --deadline (times for its first run), --wait, and an array's other tasks (--again 5005_7 runs task 7 alone, as --array=7; --again 5005 runs the whole array again). A job nomad sent before gets a new tag, and values it keeps from that job's own command line keep the code they had. Slurm keeps the command line without the quotes it was typed with, so a job sent again with arguments, or whose script nomad had to find among the line's words (or found from a folder Slurm doesn't keep, or where two scripts could have been the one), is never submitted without asking.
The job is tagged, in Slurm's --extra field, with who chose each value:
s the script's own, u the person on nomad's command line, h nomad from past runs, i the input file or command line, o how the job run again ended, g what the program needs, p a partition that fits, d left to Slurm's defaults; again=N for a job sent again; stage=l for one sent through local scratch. Slurm keeps it in its accounting where AccountingStoreFlags includes job_extra, so nomad can later tell the person's choices from its own. No tag where Slurm is older than 23.02 (no --extra; and should sbatch refuse it anyway, nomad sends the job once more untagged), where SchedulerParameters include extra_constraints (Slurm then reads --extra as node constraints) or nomad can't read them, or where the job sets --extra itself.
Where the output goes¶
Each job's Slurm output (its .out file, with what it writes to stderr unless the job splits them) goes in a folder of its own, /scratch/USER/jobs/JOBID-NAME/slurm-JOBID.out (slurm-JOBID_TASK.out for each task of an array), so the folder the job runs in fills with its own results only. nomad says where, before and after submitting.
Slurm never makes the folder an output file goes in (a job whose folder is missing fails with no output at all), and a job's number is known only once it is submitted. So nomad sends the job to start two minutes from now (--begin=now+120), reads back from Slurm where its output would go, makes its folder, and in one update (scontrol update ... StdOut=... StartTime=now) points its output there and lets it start at once. Should nomad be stopped in between (Ctrl-C, a dropped ssh session, a kill), or Slurm not take the folder, nothing is left waiting: the job starts on its own within the two minutes, its output where Slurm puts it. nomad never holds or releases a job, and a start time a site's job_submit plugin set is left as it is. What nomad then says is what Slurm holds (an update can report an error after it took effect: nomad reads the job back). The command nomad shows is the one to run by hand, without its --begin.
The job's number and name are Slurm's own (JobName, after -J, $SBATCH_JOB_NAME or the script's name), kept to letters, digits and . _ + - in the folder's name; a folder already there (a job number Slurm used before) gets .2, .3, ... jobs/ is made private (0700): change its mode to share it (folders you give with --logs follow your umask). Scratch may be purged after a while: so are the logs in it.
Left where the job or Slurm says:
- a job that sets its own output:
#SBATCH --outputor--error(or--out=: sbatch takes any prefix that is only one option's),#PBS -oor-e, its command line's (a job sent again),$SBATCH_OUTPUTor$SBATCH_ERROR; and an output a site'sjob_submitplugin set: nomad changes it only when Slurm reports its own default (slurm-JOBID.outin the job's folder); - a job that sets its own start time (
--begin,#PBS -a) or a--deadline(a later start could miss it), one sbatch waits for (--wait,$SBATCH_WAIT), a--test-only, a heterogeneous job; - the person who has no
/scratch/USER(nomad never makes it), or whose/scratch/USERisn't on a filesystem compute nodes share (NFS, Lustre, GPFS, BeeGFS, Ceph, ...; a login node that serves/scratchitself sees its own disk: a site where it is shared anyway setsNOMAD_LOGS): the output goes beside the job, and nomad says so.
A job that asks to be held (#SBATCH --hold) gets its folder and stays held, for the person to release. A job sent again doesn't get nomad's --begin (or --quiet) from its own command line.
The choice, the first one given: nomad submit --logs, then $NOMAD_LOGS, then the default. Each is here (Slurm's own place, beside the job), a folder (each job's own folder goes in it: --logs ~/runs gives ~/runs/JOBID-NAME/; a relative one is from the folder you run nomad in), or a pattern with {user}, {jobid} and {name} ({jobid} is required: each job its own folder). A site can set NOMAD_LOGS for everyone (/etc/profile.d), and a person in their own shell setup; --dry-run shows where it will go (JOBID for the number to come).
Through local scratch¶
A job on one node runs through its node's own disk (1.24): faster for the program, and lighter on the shared /scratch. nomad submit sends nomad's own small script in place of the person's, and on the node the job:
- makes
/localscratch/USER/job_JOBID(private,0700;/localscratch/USERis made if it isn't there), after checking the node has room for the job's folder and still keeps free the larger of 50 GB and a tenth of that disk (local scratch is often a folder on the node's own/). It holds a lock on it (/localscratch/USER/job_JOBID.lock) for as long as any of the job's processes lives; - copies the job's folder in (where the job runs: the folder nomad is run in, or its
--chdir) and notes each file's size, times and inode, in the folder and in the copy (and what each small file held). A relative link that leads out of the folder becomes an absolute link to where it led, so reads and writes through it go where they always went; - runs the person's script there, as it was when sent (the way sbatch keeps a script), with its own
#!line, arguments, standard input, signals and locale;$SLURM_SUBMIT_DIRis the local folder (a script that doescd $SLURM_SUBMIT_DIRstays in it),$NOMAD_SUBMIT_DIRthe folder it came from. Ansbatchthe script runs indirectly (in another script it calls) whose job would work in the node's copy is sent to work in the same folder where the job came from (a--chdiradded just before its script, and-o/-e/-ipaths into the copy mapped the same way); one that works elsewhere (its own-Dor#SBATCH --chdiroutside the copy) is sent as it is; one that would work in a folder that is only in the copy (made by this job: it isn't in the folder until this job ends) is refused, saying so. Should a job still be sent from the copy (Slurm's ownsbatchfirst on a PATH a script resets), it is moved to that folder while it waits (scontrol update WorkDir=), or else the copy is kept, and what that job writes in it is brought back (nomad-recovered-*) once it has ended; - when the script ends, stops what it left running in the background (as Slurm would at the job's end), then copies what is new or changed back to the folder it ran from, as if it had run there: what it didn't change isn't written again, and each file is written beside and renamed in place, so a copy cut short never leaves half a file. Files it deleted or renamed there aren't deleted or renamed in the folder. What changed in the folder while the job ran is never undone: a file the person or another job changed there meanwhile is left as it is, and the job's version goes in
nomad-conflicts-JOBID/in the job's folder (the job then ends with exit code 75, and its.outsays which); a file of lines both only added to at its end (a log, a table of rows) gets the job's new lines added after the others' (never a file that was empty, or whose beginning either one changed); a file only touched orchmoded there meanwhile (the same content) isn't a conflict, and keeps its new mode. Jobs from one folder copy back one at a time (a lock on the folder's.nomad-lock, which stays there, hidden, writable by all so a lab's members' jobs take turns too). Where that lock can't be shared between nodes (NFS mountednolockorlocal_lock=), can't be had, or another job holds it for over 15 minutes, the copy back goes file by file and checks each one just before it goes in; - checks each file it copied back (sha256 of both copies, the one on
/scratchread back from the server, not the node's cache; a link's target; a folder), copies again what doesn't match, and only then removes the local folder (and keeps it while any process still works in it). What still doesn't match stays on the node, the job's.outsays what and where, a job pinned to that node brings it back once this one ends (see below), and a job that had succeeded ends with exit code 75, so Slurm records it as failed.
The job's .out says what it did (nomad-stage: copied ... to /localscratch/amy/job_4242 on n005 in 12s, copied back 3 new or changed item(s) (1.2 GB) ... and checked each (sha256)). It uses rsync where the node has it (else Python's own copy) and the node's own python3 (/usr/bin/python3, isolated: -I, so a cluster's PYTHONHOME or PYTHONPATH don't reach it); nothing of nomad's is needed on the node. nomad's own steps run without the job's LD_LIBRARY_PATH and LD_PRELOAD (a login environment's can break system tools: 1.24.1); the script gets them back as they were.
Time limits and stops. nomad asks Slurm to warn the job before its limit (#SBATCH --signal=B:USR1@600, a sixth of a limit under an hour but at least 5 minutes; not when the script sets its own --signal). At the warning the job stops the program (TERM to it and everything it started, KILL after a minute), copies back what it has, checks it, then waits for the limit, so Slurm still records the job as TIMEOUT (and nomad's sizing reads it as one). scancel -b -s USR1 JOBID does the same at any time and ends the job there. A job cancelled (scancel) or preempted: Slurm has already sent TERM to all of it and KILLs it after KillWait (30 s on hpc1); the program keeps 15 s of that, the copy back the rest. A script's own --signal=B:SIG still reaches it (nomad's script passes it on).
What a stopped job leaves. When a job is stopped, or its copy back fails, it first sends a small job of its own (nomad-recover-JOBID: one CPU, 1 GB, 2 hours, pinned to that node with -w, --dependency=afterany:JOBID, its output in the job's folder). That job, once the first has ended, brings back what is still on the node; so does the person's next staged job on that node (up to three such folders, when it has 15 minutes left). Either one takes only a folder whose lock is free (its job is gone), and puts what it brings back in a folder of its own, nomad-recovered-NODE-TIME/, in the job's folder (/scratch/USER/jobs/JOBID-NAME/, beside its .out; else where the job ran): nothing recovered ever overwrites anything. A folder an earlier run of the same job left (a job requeued onto the same node) is moved aside for that, never copied over the new run's results.
Sent as it is, and nomad says why: a job on several nodes (each would have its own local scratch); an array (its tasks would each copy the folder, with what the others brought back: --localscratch stages it anyway, up to a tenth of the size limit; an array that comes from $SBATCH_ARRAY_INX is caught on the node); a time limit under 30 minutes (too short to gain from it, and to copy back before the limit); a script that leaves its folder itself (cd /abs/path, cd ~, cd .. or any .., cd $OTHER, cd -, popd; cd $SLURM_SUBMIT_DIR and folders inside it are fine) or sends jobs itself (sbatch anywhere in its commands, nomad submit, Snakemake, Nextflow, Cromwell, Toil, FireWorks, Parsl: a job sent from the node's copy would start there); a folder larger than 50 GB ($NOMAD_STAGE_MAX, e.g. NOMAD_STAGE_MAX=200G); the person's home folder itself (submit from a project's folder); a script without a #! line or with DOS line breaks, --wrap, --test-only and heterogeneous jobs. On the node, the job runs where it is (as without nomad) when the node has no /localscratch, no python3, not enough room, or Slurm gave it several nodes. --no-localscratch sends a script as it is; NOMAD_LOCALSCRATCH=off does it for every job (a site in /etc/profile.d, a person in their own shell setup), and --localscratch turns it on for one job even then. NOMAD_LOCALSCRATCH=/local/{user}/scratch puts the local folder elsewhere ({user} required). The jobs folder (/scratch/USER/jobs) is never copied in, when the job runs from a folder that holds it.
nomad's copy of the script. What sbatch is given is nomad's script, named as sbatch would have named the job (--job-name= the script's name, unless it names itself). Its first lines say which script it carries, and it carries that script's text, so nomad still knows the person's own script for a job sent this way: nomad submit --again runs the person's script (staged again), and past runs are compared by it. The tag records it: ;stage=l. Since 1.25.2 sbatch reads that script on its standard input (sbatch [OPTIONS] < FILE; /dev/stdin before the job's arguments when it has some), never from a file of nomad's that someone could change before sbatch reads it; nomad keeps its record of it in ~/.local/share/nomad/staged/NAME-HASH.sh (private; the same job sent again is the same file; those unused for 400 days are removed), and notes which record each job came from by its cluster and number (staged/jobs/CLUSTER.JOBID: Slurm keeps no file name for a script it read on its standard input), with the job's folder and when it was sent: a note that doesn't agree with Slurm's record of the job (another cluster sharing the home, a number Slurm used again) isn't taken for it. Notes go with the records they name, after 400 days. The command nomad shows ends < RECORD: the same job, by hand.
What runs differently from an unstaged job: results appear in the folder when the job ends, not while it runs (watch the local folder on the node, or the .out); a file another job or the person changed in the folder meanwhile keeps their change, the job's own version set aside (above); a job that restarts from its own checkpoints after a requeue starts again from the folder, so it should write its checkpoints by their full path, or use --no-localscratch. Files a copy back writes are written in a hidden .nomad-tmp-JOBID/ in the folder first and renamed into place (a recovery removes one a stopped job left).
What it reads¶
- The script, and the input file it names (at most 2 MB), as the person: their own run of nomad reads their own files.
- Slurm's accounting: the person's own jobs of the last 180 days (
--days), withsacct -uand the person's own user name (from the system, never from$USER). The full folder and submit line let nomad find each past job's script and name its program. Slurm before 21.08 has no submit line: jobs are then compared by name only. - The partitions:
scontrol --all show partitionandsinfo -a -e(hidden ones too; each kind of node on its own line), the person's groups and Slurm accounts (sacctmgr show assoc,show user).
nomad size --db PATH --user NETID sizes a script from nomad's database instead (on the hub, for staff), where folders and command lines are never kept whole, so jobs are compared by name only (and so only raise values); --job looks at one's own jobs only.
Installing it for users¶
Users run one central install on each cluster, not one of their own, and nomad size and nomad submit need no nomad.toml. scripts/install_nomad_for_users.sh makes it, as the account that owns the folder (/usr/local/sw/nomad, or NOMAD_USERS_DIR), on the cluster or from a nomad checkout:
ssh OWNER@CLUSTER 'bash -s 1.18.1' < scripts/install_nomad_for_users.sh
ssh OWNER@CLUSTER 'NOMAD_USERS_DIR=/path bash -s 1.18.1' < scripts/install_nomad_for_users.sh
Running it again with another version upgrades: that is how a cluster follows nomad's releases, one step of each release beside the hub's upgrade.
- Each release whole in its own folder.
releases/VERSIONholds its own Python 3.12, installed by uv (from uv's release on GitHub, checked against a checksum fixed in the script), and its own environment, so the system's Python doesn't matter (apython3of 3.6 is fine). uv's cache and downloads are in a private temporary folder, and one run goes at a time. - One step to switch. The release is built and checked first; only then is
bin/nomadreplaced, in one step, by one that runs it. Until then users go on with the one they had, and a release that fails is removed. The one before is kept (with itsbin/nomad, asbin/nomad.before), and the script prints how to go back to it; older ones are removed. Two releases take about 0.9 GB. An install made by 1.18.0's script is replaced the same way, and its folders removed after the switch. A removal that fails then (a file still open on NFS, say) is reported and left for the next run. - The right folder. The script refuses a folder another account owns (run it as that account), and one that holds anything it doesn't recognise as its own or 1.18.0's script's (a wrong
NOMAD_USERS_DIR, say): such a folder is left untouched. bin/nomadstarts nomad's Python isolated (python -I, writing no bytecode), soPYTHONHOMEandPYTHONPATHa cluster sets for another Python (Anaconda's, say) don't reach it, while the jobs nomad submits get the environment as it is.- Nothing writable but by the owner, nor owned by anyone else; the script stops if it finds otherwise, and says so when a folder above the install is writable by others (who could then replace it).
- On users' PATH:
bin/holds onlynomad(and, from 1.25.0,nomad-gate: see below; run by anyone else it does only what they could do themselves), so it can't shadow anyone's Python. A link in a folder already on everyone's PATH (ln -s /usr/local/sw/nomad/bin/nomad /usr/local/sw/bin/nomad), or a module, or/etc/profile.d; last on the PATH, an account with its own nomad keeps it. check_current.sh, beside it, says when nomad-hpc has a newer release than the one installed (and prints the command that upgrades) and says nothing otherwise: for the owner's crontab, weekly, withMAILTOset. It never upgrades anything itself.bin/nomad-gate(1.25.0 and later): what the hub's gate key runs on the cluster (below). It runs the same release asbin/nomad, is switched with it (and kept asbin/nomad-gate.before), and is left out for a release that has none (a release that has it but whose gate doesn't start stops the install). After the switch the script asks itnomad-gate checkand says if it wouldn't serve as installed. To go back from 1.25.0 or later, use thebackcommand the script printed, or this script from 1.25.0 or later: an older checkout's script doesn't knowbin/nomad-gateand stops.
From the Console: nomad-gate¶
The Console's Submit page (and Run it again) sends a person's job as that person, through nomad-gate on the cluster:
- A key that can do one thing. The hub has a key of its own for this (
~/.config/nomad/gate/id_ed25519of the Console's account;nomad gate keymakes it), apart fromnomad sync's and the actions' agent key. On the cluster its line in the nomad account'sauthorized_keys(nomad gate install-key, which refuses a gate path that isn't plain or isn't safe to run from) hasrestrict(no terminal, no forwarding),from=the hub's address (an address: host names work only where sshd hasUseDNS yes) andcommand="/usr/local/sw/nomad/bin/nomad-gate serve": whatever is sent with that key, sshd runs only the gate. The hub offers only that key (no agent, no other key, no shared connection, none of its account's ssh settings nor the system's:-F /dev/null, so the cluster is reached directly, with ssh's own defaults) and refuses an unknown host key: the Console's account needs the cluster's host key in its~/.ssh/known_hostsunder the very namehostgives (not an alias from an ssh config). - A short list.
version,size --script PATH | --job N,submit --script PATH --sha256 HEX(with the person's own--cpus --mem --time --gpus --partition --keep --localscratch/--no-localscratchif they gave any),again --job N --sha256 HEX(the same),jobs(theirs,squeue -u: each one's state, time, nodes or why it waits, folder, and from 1.58.1 its partition and the cores and GPUs it asked for),job --job N(one of theirs: Slurm's view of it now, its accounting -- steps, memory, CPU time -- and the end of its output, read as them; someone else's is refused),cancel --job N,ls --dir PATH(to pick a script) andshow --script PATH(its text and sha256). Every value is checked (a job number,8G,4:00:00, a partition's name, a full path without.or..parts or invisible characters, a sha256), by the hub before sending, by the gate as the cluster's account, and again as the person; nothing ever goes through a shell. At most four requests are served at once on the cluster; more are told it is busy. - What was shown is what is sent (1.25.1). A script to send or show must be the person's own regular file (not a link), at most 256 KB, beginning with
#!. To send it, the Console passes the sha256 of the text it showed them (for a job sent again, of its script, which it shows too); the gate refuses a script that is no longer that text ("changed since you looked at it"),nomad submitchecks it once more, and sbatch is given that text itself, never the path: the local-scratch script (which carries it), else the text as it is, on sbatch's standard input (1.25.2; 1.25.1 gave sbatch a private copy, so it refused while someone else could change a folder above that copy). nomad keeps its record of it in~/.local/share/nomad/staged/with, beside it, the path of the person's own script, so the job is sent again (and compared with) from theirs. So a folder others can change (a/scratch/USERwritable by everyone's group, say) can't swap the script on its way. It is said, not refused:showgives awarningnaming the first file or folder others could change, and thechmodthat closes it (the person's own private group aside, without an access list; an NFSv4 access list on a NAS can't be seen). What the job reads from such a folder (its input, programs it calls) is as open as it is without the Console. The script is read once, checked, and that very text is what nomad sizes, stages and sends; one that isn't plain UTF-8 text is sent exactly as it is, not through local scratch. - Text files (1.25.4). Besides job scripts, the Console opens and saves a person's own text files with an extension on
TEXT_EXTENSIONS(.py .R .m .jl .sh .in .inp .com .gjf .yaml .yml .json .toml .cfg .conf .txt .md, any case):read --path PATHgives one's text and sha256 (only withserve --edit, assave, and where the hub'sedit = true),savewrites one with the same rules as a script (the person's own regular file, not a link, UTF-8, at most 256 KB, no NUL, no hidden part in its path nor its folder as it really is, no other name for it (a hard link: it could be any file of theirs, a hidden one too); only over the very text opened, or as a new file; the text before kept).versionsandrecallare behind the same switch now.lsmarks themtext. A file of any other kind (data,.csv, notebooks, binaries) isn't opened. - Saving a script (1.25.3). Off unless both sides say so: the site's
[[hub.sites]]hasedit = true(the Console asksremote.editing), and the cluster's nomad account let the hub's key in withnomad gate install-key ... --edit(sshd then runsnomad-gate serve --edit; without it the gate refuses every save). That is the cluster's choice because it changes what the hub's key can do: with it, whoever holds the key could write a person's script and send it, that is run code as anyone the gate acts for, not only send the scripts they already have.nomad gate test --site Ssays which side has it on.save --script PATH (--sha256 HEX | --new) --body-sha256 HEX, the text on standard input: the person's own job script, written as them, only over the very text they opened (and only UTF-8 text:showsaysutf8) or as a new file (mode 600: the gate can't know the umask the person's login sets), never through a link or into a hidden file or folder (as given, or as the folder really is); written beside it and put in its place in one step, keeping its mode, group and access lists (none taken from the folder's default list); the text before kept first, privately (~/.local/share/nomad/versions, the last 20 of each script;versions --script PATHlists them,recall --script PATH --id IDgives one back). The gate's syslog line has the sha256 before and after. - The account, and the sbatch that is run (1.25.2).
show'swarningalso names the first place in the person's own account others could change so as to run programs as them -- their home folder, the files bash reads when they log in (~/.bash_profile,~/.bash_login,~/.profile,~/.bashrc), and~/.local(bin/is on PATH,lib/python*/site-packagesis read by Python at its start,share/nomadholds nomad's records) -- with what closes it (chmod -R go-w ~/.local; above the home folder, the site's). It is open with or without the Console (the person's own logins run the same files), so it is said, not refused, and it is no longer said once it is closed: nothing to change in nomad when the site changes how accounts are set up. From the Console, Slurm's programs (sbatch,scontrol,sinfo,sacct,sacctmgr,squeue,scancel) are each found once on the person's login PATH, before any of them runs, and run by their full paths (so nothing put earlier on PATH meanwhile runs instead); nothing runs when one of them, a folder above it or a link on the way to it (each link followed in turn) belongs to an account other than root, the person, the account nomad is installed by or Slurm's own, or could be changed by others -- someone else could have put it there, and it would act as the person (sbatchwould be given the text they saw). The gate's own steps (jobs,job,cancel) go throughnomad-gate exec NAME, in the person's login, for the same check. By hand, nomad runs them by name, as before. - As the person. The gate acts as the person with the cluster account's own sudo (
sudo -n -u PERSON nomad-gate run ...), never as root, a system account (uid under 1000,nobody), the gate's own account or nomad's own accounts. It first asks sudo whether it may (sudo -n -l, by its exit status); where it may not (on one cluster the account may act as members of one group only), the answer says so, and the Console gives them the command to paste instead. - As if they typed it. nomad runs in the person's login environment (
bash -l, as when they log in; a tcsh or zsh user gets bash's login setup, not their own), from the script's folder (from their home folder foragain), with nothing on its input and the login's own locale, so the job gets the environment it would by hand; it is taggedvia=console. Each answer is one line of JSON. A job that may have been sent without the gate being able to say so (sbatch slow to answer, the connection lost on the way) is said to be maybe sent, so it isn't sent twice; sending waits up to 10 minutes. - Logged. Each request goes to the cluster's syslog (authpriv,
/var/log/secureon RHEL), as plain text: who, what, and the job it made; sudo logs it too. - Refused when it is installed wrong. The gate doesn't serve when it, the
nomadbeside it, their Python, or anything in the release's environment and Python could be changed by anyone but its owner or root (nomad-gate checksays what). It is a check for a mistake in how it was installed, made when it serves (a pass is kept for a minute); it can't undo a change someone already made.
Setting it up, once per cluster:
# on the hub, as the Console's account (where the Console runs as nomad, with /etc/nomad/nomad.toml):
sudo -u nomad -H /opt/nomad/venv/bin/nomad -c /etc/nomad/nomad.toml gate key
# on the cluster, as its nomad account (after install_nomad_for_users.sh 1.25.0 or later):
/usr/local/sw/nomad/bin/nomad gate install-key 'ssh-ed25519 AAAA... nomad-gate@hub' --from HUB-ADDRESS
/usr/local/sw/nomad/bin/nomad gate install-key 'ssh-ed25519 AAAA... nomad-gate@hub' --from HUB-ADDRESS --apply
# on the hub: in that site's [[hub.sites]] of nomad.toml
submit = "gate"
# gate_user / gate_host: when not ssh_user / host; [hub] gate_key: another key file
# edit = true: the Console may also save people's job scripts there (1.25.3), if the
# cluster agrees: install-key ... --edit (run it again with --edit, the same key and --from)
# then, as the Console's account: is it there, and may it act as you?
nomad gate test --site CLUSTER --user YOU
nomad gate ask --site CLUSTER --user YOU size --script /scratch/YOU/run/job.sh
nomad-gate run OP ..., run by a person on the cluster, answers as the hub would get it, as them (nomad-gate run jobs): handy to see what the Console will show.
A cluster reached through another host (1.40.0)¶
A cluster the hub can reach only through another host (hpc3, through labhead1) says so in its [[hub.sites]]:
[[hub.sites]]
name = "hpc3"
host = "hpc3" # as the other host reaches it
ssh_user = "nomad"
submit = "gate"
gate_jump = "monitor@labhead1" # account@host, or account@host:port
The hub then asks the gate through that host with the gate's own key and the same settings as always (none of its account's ssh settings, so nomad sync's ProxyJump is never used): the key opens a forwarded connection to the cluster's ssh there (ssh -W), and nothing else. On the host it jumps through, as that account, once:
nomad gate jump-key 'ssh-ed25519 AAAA... nomad-gate@hub' --to hpc3:22 --from HUB-ADDRESS
nomad gate jump-key 'ssh-ed25519 AAAA... nomad-gate@hub' --to hpc3:22 --from HUB-ADDRESS --apply
Its line has restrict (no terminal), forwarding allowed again only to --to (permitopen), command="/bin/false" should anyone ask it for a session, and from= the hub. On the cluster, nomad gate install-key takes the address the cluster sees the connection come from: the host jumped through, not the hub. The Console's account must know both host keys under those very names (the jump host's as gate_jump names it, the cluster's as host does), as with any gate.
Where it starts soonest (1.25.4)¶
On the Console's Submit page, Where would it start soonest? lists the partitions the person may send the job to, in the order the site prefers, each with when Slurm would start it there now and how long jobs usually wait there. One click puts a partition in Yours. Fastest start takes nomad's pick by itself.
- Slurm's own estimate. The gate's
starts --script PATH --sha256 HEX --partitions P1,P2,...(with the person's--cpus --mem --time --gpus --keep;--job Ninstead of--scriptfor a job sent again) runsnomad submit --startsas the person, which givessbatch --test-onlythe very text they were shown, as nomad would send it, once for each partition (at most 12, four at a time, each at most 60 s, its times in ISO form whatever the person'sSLURM_TIME_FORMAT). Nothing is submitted. An estimate Slurm gives for another partition than the one asked (a site'sjob_submitmoving it) isn't taken for it. The gate answers at most two of these at once (STARTS_HERE), so they never hold up sending; the Console asks for one person's job at a time, and two at once in all. It answers with each start time, the nodes' states (sinfo), and the values nomad would send. Where running jobs have no time limit, Slurm can't tell when a node frees and puts the start a year or so away: a start 7 days or more away is shown as "later (Slurm can't say when)", with its date, and nomad doesn't rank by it. Beside it, the usual wait from nomad's own records (the median over 30 days, at least 5 jobs). - The order. The hub sorts the cluster's partitions from its own records (the nodes in each, their memory and GPUs) and the condo reports'
report.toml(each condo's owners, nodes and members; itsguest_partitions): - your lab's condo: for its owners, and the people its
membersnames inreport.toml(a list, agroup:, or anaccount:'s users this past year). Withoutmembers, only its owners (1.25.6): the condo reports then take the owners' lab groups, but such a group can hold far more than the lab, and "yours" has no guest limit.nomad partitions --site S --sortedlists the condos withoutmembers; - shared: the nodes with the least memory, where any job may go; GPU nodes only for jobs that ask for GPUs;
- the default partition, whatever it holds: where the job goes if it names none;
- labs' condos, as a guest: a partition holding several condos stands for them all (Slurm picks the free one). Only for a job with a time limit within
guest_max_days(the condo policy's,[report.policy] guest_max_days); - big-memory nodes: shared nodes with more memory than the least any shared CPU node has. They are few, and kept for the jobs that need them. A job that doesn't need them goes there only with a time limit of at most
overflow_max_hours, so the node comes back at a known time, and only while more thanreserve_nodesof them are idle (whensinfodidn't say, not at all). A job that needs them gets them first. - A partition of nodes of several kinds (every node, say) isn't suggested. Partitions with the very same nodes are one (the others shown as "also"). A shared partition inside another of its kind is left to that one. A job that names any of these keeps it.
- What nomad doesn't know, it doesn't offer. A partition with a node nomad has no memory reading for is of several kinds (not suggested); while any shared node has none, no partition is "shared, least memory" for sure (the default is still offered). A condo
report.tomllists but hasn't confirmed is a condo's nodes, never shared ones (and no one's own until confirmed). The nodes of a guest partition (guest_partitions, or one named like "condo") are condos' nodes even wherereport.tomllists no condo for them: offered to guests, no one's own. A site with no condos table inreport.toml([report.clusters.SITE.condos]), or a listed condo whose nodes nomad can't find (nonodes, and itspartitionisn't Slurm's now), gets only its default partition suggested, and the page says why: write the table (nomad usage-report condos init; an empty one for a site with no condos), or fix the condo's partition. - Nodes that run slow (1.27.0): a partition whose nodes the clock collector finds throttled (a CPU braked far below its clock: Collectors, "CPU clocks") isn't suggested when all of them are, says which when some are, and isn't nomad's pick while another partition has none.
- nomad's pick is the first in that order that would start now, else the one Slurm says starts soonest (not "later"), else the shortest usual wait, else the first in the order. Fastest start takes the same, only on something known (else nothing), and never another lab's condo unless
fastest_guests = true. It never replaces a partition the person typed while Slurm was asked. Each row that can't be suggested says why. - Nothing changes in Slurm. The person's choice goes in Yours, and is sent as any other value of theirs. With "Keep the job's own values" ticked the partition is the script's: nothing here can be chosen until it is unticked.
nomad partitions --site SITE --sorted (on the hub) shows how a site's partitions are sorted, and what nomad doesn't know yet (condos not confirmed, nodes with no memory reading): look at it before people rely on the page.
In the hub's nomad.toml ([submit.where.SITE] for one site; these are the defaults):
[submit.where]
guests = true # offer other labs' condos to guests
# guest_max_days = 10 # default: report.toml's [report.policy] guest_max_days
overflow_max_hours = 24 # a job that fits the small nodes, on big ones: at most this long
reserve_nodes = 1 # big-memory nodes kept idle for the jobs that need them
fastest_guests = false # Fastest start may pick another lab's condo by itself
Making a script (1.26.0)¶
For someone with no job script yet, the Console's Submit page has No script
yet? Make one: they pick the program, its version, and their input (a file,
or a folder of inputs), and nomad writes the script. It is shown in full and
can be changed, then saved beside the input as a new file, as them, through
the gate's save (only where saving is on: From the Console;
elsewhere they copy it). From there it is sized, checked and sent as any
other script.
- A template per program, written once by the site's staff in the hub's
nomad.toml (
[[submit.templates]]): how the site runs it, which modules are its versions, what to ask when nothing better is known. - The versions the cluster has, from its
modulescollector (Collectors, "Environment modules"): the modules matching the template's patterns, copies kept aside (.bak,.old, ...) left out. Chosen first: the template'sdefaultwhen the cluster has it, else the cluster's own default, else the highest version; the person can pick any. A version that runs otherwise (Gaussian 09 and 16) gets its own line (run_for). - Text only. Making a script runs nothing and reads no file: the path is
the person's choice in the file browser, and its name goes into the script
quoted for the shell. The script is named after the input (
water.gjf→water.sh; a folder of inputs →run.shin it); the page offerswater-2.shwhenwater.shis there already, and says when an output the job writes (water.log) is there already.
In the hub's nomad.toml:
[submit.build.hpc1] # a site's own settings
module_paths = ["/usr/local/sw/modulefiles"] # module use, before module load
scratch = "/scratch/$USER/$SLURM_JOB_ID" # {scratch}: must name the job ($SLURM_JOB_ID)
[[submit.templates]]
program = "Gaussian"
sites = ["hpc1", "hpc2"] # where it is offered (default: every site)
modules = ["gaussian/*"] # its versions (shell patterns)
default = "gaussian/latest" # chosen first, when the cluster has it (or a list)
inputs = [".gjf", ".com"] # the input: a file with one of these endings ...
# folder = "control.run" # ... or a folder holding this file (run there)
setup = ["export GAUSS_SCRDIR={scratch}", "mkdir -p {scratch}"]
run = "g16 < {input} > {stem}.log"
after = ["rm -rf {scratch}"]
outputs = ["{stem}.log"] # said if one is there already
cpus = 8 # what to ask when nothing better is known
mem = "16G"
time = "1-00:00:00"
# gpus = 1
# partition = "gpunodes" # or one a site: { hpc1 = "gpunodes" }
# parallel = "mpi" # cpus as --ntasks (MPI), not --cpus-per-task
[submit.templates.run_for]
"gaussian/g09*" = "g09 < {input} > {stem}.log"
In a template's lines: {input} (the input's name, quoted for the shell),
{stem} (its name without the ending), {folder} (where the job runs),
{cpus}, {tasks} and {threads} (1.29.0: the processes and each one's
threads), {mem_mb} (the job's memory, MB), {mem_mb_each} (each process's
share of nine tenths of it: Columbus's runc -m), {gpus}, {module},
{scratch}; anything else in braces stays as it is (${SLURM_CPUS_PER_TASK}).
A template's options (1.29.0)¶
A template may offer a few choices, shown on the page beside the version: how it runs in parallel, which program of a suite, what it does when it is put back in the queue. At most four options, each of two to six choices; the first is chosen unless the person picks another, so a template's usual way needs no choosing. A choice changes only what it names:
[[submit.templates]]
program = "CP2K"
modules = ["cp2k/*"]
inputs = [".inp"]
parallel = "mpi"
cpus = 16
run = "srun cp2k.psmp -i {input} -o {stem}.out"
outputs = ["{stem}.out"]
[[submit.templates.options]]
name = "parallel" # a short key (--choose parallel=2)
label = "Runs as"
[[submit.templates.options.choices]]
label = "MPI processes, one a core"
omp = true # export OMP_NUM_THREADS={threads} (1 here)
[[submit.templates.options.choices]]
label = "MPI processes of 4 threads each"
parallel = "hybrid" # --ntasks = cpus / 4, --cpus-per-task = 4
threads_per_task = 4
omp = true
[[submit.templates.options]]
name = "restart"
label = "If it is put back in the queue"
[[submit.templates.options.choices]]
label = "Goes on from its restart file"
setup = ['[ "${SLURM_RESTART_COUNT:-0}" -gt 0 ] && echo "requeued: the input reads {stem}-1.restart"']
[[submit.templates.options.choices]]
label = "Starts over"
What a choice may set: run (in place of the template's), setup and
after (lines added to the template's: its own clean-up stays last),
outputs, sbatch (options of nomad's own: --constraint=a100; not those
nomad writes itself), parallel, threads_per_task, omp, cpus, mem,
time, gpus, partition. Only one option may set the run line, and only
one how it runs in parallel. parallel is "threads" (one process,
--cpus-per-task), "mpi" (one process a CPU, --ntasks, on one node) or
"hybrid" (processes of threads_per_task threads each, on one node). A
choice's sizes are what the script asks for unless the person says otherwise.
Every made script also:
- writes Slurm's output file with
--open-mode=append, so a job Slurm puts back in the queue (a condo's owners took its node) keeps what it printed before; - names each choice in its heading (
# Runs as: MPI processes of 4 threads each); - reads the counts as the job has them when it runs:
{tasks}is${SLURM_NTASKS:-16},{threads}${SLURM_CPUS_PER_TASK:-4}(and{cpus}the one that fits), so a job resized when it is sent (nomad size, the Console's sizing) runs as many processes as it has, not the number first written;{mem_mb_each}is each process's share (all of it for one process of threads); - with threads and
srunin its lines, exportsSRUN_CPUS_PER_TASK: since Slurm 22.05 a step doesn't take the job's--cpus-per-taskby itself, and would run on one CPU.
nomad templates --site hpc1 --hub each template's options, numbered
nomad templates --site hpc1 --hub --make CP2K --input /home/amy/h2o.inp --choose parallel=2
{scratch} stops at once when it isn't run by Slurm
(bash water.sh, or sourced: its rm -rf {scratch} would otherwise take
the person's whole scratch folder), and a site's scratch must name the
job ($SLURM_JOB_ID; else /tmp/$USER/$SLURM_JOB_ID, and it is said).
A template that can't be used (a bad pattern, an unknown place, a partition
that isn't a name) is said, never guessed at: nomad templates --site S
lists the problems, and the Console shows them to its admins.
nomad templates --site hpc1 --hub the programs, each with its versions there
nomad templates --site hpc1 --hub --make Gaussian --input /home/amy/water.gjf
nomad templates --site hpc1 --hub --make Gaussian --input /home/amy/water.gjf --module gaussian/g16c02
Guests on condos, and the owners' first claim (1.28.0)¶
A condo's owners paid for its nodes; others may run there while the nodes are
free, as guests, and give them back when the owners need them. That is
Slurm's to do: the owners' partition at a higher PriorityTier, admitting
their lab; a guests' partition (condo_overflow) holding the condo nodes at
the lower tier, with PreemptMode=REQUEUE and a GraceTime; and
PreemptType=preempt/partition_prio (with PreemptMode=REQUEUE, which
then applies to every partition that sets none: every other partition gets
PreemptMode=OFF on its line). When an owner's job needs a node a guest
holds, Slurm signals the guest job's steps (SIGTERM to programs started with
srun; a program the script runs itself hears nothing until the end), waits
up to the grace time, then stops the job and puts it back in the queue: the
same job, run again from the top of its script, wherever nodes are free
(cancelled instead if it asked --no-requeue, isn't a batch job, or the
cluster has JobRequeue=0 and it didn't ask --requeue).
The switch is Slurm's configuration, applied by the site's staff; nomad follows what Slurm does:
nomad partitions --site S --condos(on the hub) checks each confirmed condo of report.toml against Slurm: the owners first on their nodes, only their lab in their partition (report.toml'smembers = "group:smith$"against the partition'sAllowGroups; a condo two labs share names both,"group:lee$,patel$", and Slurm admits anyone in either; or"account:NAME"(else the condo's ownaccount) againstAllowAccounts, which keeps others out only where Slurm enforces associations,AccountingStorageEnforce; a condo whose members name neither isn't ranked first: anyone could then send jobs there and preempt the guests), every other partition on those nodes a guests' one. It prints what slurm.conf would change to turn it on, line by line, and the same settings as scontrol shows them now, to turn it back off. The guests' partition is added beside today's (condos), which is drained and removed once its jobs are done (jobs in a partition that is gone fail); until then both are guests' doors, and report.toml'sguest_partitionslists both (the condo reports find the guests through it). It also says when the grace is longer than report.toml's[report.policy] owner_start_minutes: an owner's job can wait the whole grace, and the reports would count it late. Slurm's own preemption settings are read with the partitions (nomad 1.28.0's node_state collector,scontrol show config).- Where it starts soonest tells a guest, on the guests' partition's row, what happens when the owners need their nodes, once Slurm preempts there.
nomad size --requeue job.shsays whether a script survives being requeued, and what to change:--no-requeue, a log written anew (--open-mode=append), a program that starts over instead of resuming from its checkpoint (GROMACS-cpi, VASP'sCONTCAR, CP2K's restart file, Gaussian's%chk, ORCA's.gbw;$SLURM_RESTART_COUNT), steps that fail the second time (mkdirwithout-punderset -e,rmormvof inputs), files kept on the node's own disk.- A message when it happens (
notices = true): thepreemptionscollector on the cluster keeps each job instance Slurm preempted (sacct -D -s PR), and whether the job came back (requeued) or was cancelled; after each sync the hub emails the person (their NetID at report.toml'smail_domain), one message a person a run, each job once, only where Slurm preempts that partition: where it ran, for how long, what Slurm did, how to make it resume next time (in a message about many, the cancelled first). A job that ended minutes ago and isn't known to be back in the queue yet waits a sync. The first run after turning notices on (or after two days with notices off) only notes what is there.
In the hub's nomad.toml (these are the defaults):
[submit.preemption]
guest_partition = "condo_overflow" # the guests' partition the plan names
grace_minutes = 30 # GraceTime the plan proposes
owner_tier = 2 # the owners' PriorityTier the plan proposes
notices = false # email a person when a job of theirs is preempted
On the cluster's (the head node's account, which sees every user's jobs):