Slurm CLI ========= This page provides a guide for users willing to **submit Slurm jobs** from the `Magellano login shell `__. The content of this guide and the examples therein are sufficient for most use cases. However, for mode detailed information, we recommend reading the `Slurm User Documentation `__. Cluster information (``sinfo``) ------------------------------- View partition and node information for a system running Slurm. **Usage:** ``sinfo [OPTIONS]`` Options ^^^^^^^ .. list-table:: :header-rows: 1 :widths: 30 70 * - Option - Description * - ``-l``, ``--long`` - Long output - displays more information * - ``-n``, ``--nodes=NODES`` - Report on specific node(s) * - ``-N``, ``--Node`` - Node-centric format * - ``-p``, ``--partition=PARTITION`` - Report on specific partition * - ``-s``, ``--summarize`` - Report state summary only Examples ^^^^^^^^ Show a summary of available partitions:: $ sinfo -s PARTITION AVAIL TIMELIMIT NODES(A/I/O/T) NODELIST any* up 30-00:00:0 1/23/0/24 e1wn[1-20],ne2wn[29-32] levante up 30-00:00:0 1/19/0/20 e1wn[1-20] mefisto up 30-00:00:0 0/4/0/4 ne2wn[29-32] Show the status of a subset of nodes in the ``levante`` partition:: $ sinfo -N -n e1wn[1-3] -p levante NODELIST NODES PARTITION STATE e1wn1 1 levante mix e1wn2 1 levante idle e1wn3 1 levante idle Batch Jobs (``sbatch``) ----------------------- Submit a batch script to Slurm. **Usage:** ``sbatch [OPTIONS...] SCRIPT [ARGS...]`` Options ^^^^^^^ .. list-table:: :header-rows: 1 :widths: 30 70 * - Option - Description * - ``-A``, ``--account=ACCOUNT`` - Charge job to specified account, default is ``default`` * - ``-c``, ``--cpus-per-task=NCPUS`` - Number of cpus required per task, default is ``1`` * - ``-e``, ``--error=ERR`` - File for batch script's standard error, default is a file in your current working directory * - ``-J``, ``--job-name=JOBNAME`` - Name of job * - ``--mem=MB`` - Minimum amount of real memory * - ``--mem-per-cpu=MB`` - Maximum amount of real memory per allocated cpu required by the job * - ``-n``, ``--ntasks`` - Number of tasks to run, default is ``1`` * - ``--ntasks-per-node=N`` - Number of tasks to invoke on each node * - ``-N``, ``--nodes=N`` - Number of nodes on which to run, or range in the format ``min[-max]`` * - ``-o``, ``--output=OUT`` - File for batch script's standard output, default is a file in your current sworking directory * - ``-p``, ``--partition=PARTITION`` - Partition requested, default is ``any`` * - ``-t``, ``--time`` - Time limit, default depends on partition configuration Examples ^^^^^^^^ Submit a non-interactive batch script and require 8 cpus on the ``mefisto`` partition:: $ sbatch --cpus-per-task=8 --partition=mefisto my_script.batch Specify a name for the job, and redirect the standard output and standard error to text files in your home directory:: $ sbatch --job-name=my_job --output=$HOME/my_job.out --error=$HOME/my_job.err my_script.batch Specify a time limit of 3 hours for your job and charge it to the ``hpcfriends`` account:: $ sbatch --account ``hpcfriends`` --time=03:00:00 my_script.batch Parallel Jobs (``srun``) --------------------------- Run parallel jobs. **Usage:** ``srun [OPTIONS...] EXECUTABLE [ARGS...]`` Options ^^^^^^^ .. list-table:: :header-rows: 1 :widths: 30 70 * - Option - Description * - ``-A``, ``--account=ACCOUNT`` - Charge job to specified account, default is ``default`` * - ``-c``, ``--cpus-per-task=NCPUS`` - Number of cpus required per task, default is ``1`` * - ``-e``, ``--error=ERR`` - File for batch script's standard error, default is a file in your current working directory * - ``-J``, ``--job-name=JOBNAME`` - Name of job * - ``--mem=MB`` - Minimum amount of real memory * - ``--mem-per-cpu=MB`` - Maximum amount of real memory per allocated cpu required by the job * - ``-n``, ``--ntasks`` - Number of tasks to run, default is ``1`` * - ``--ntasks-per-node=N`` - Number of tasks to invoke on each node * - ``-N``, ``--nodes=N`` - Number of nodes on which to run, or range in the format ``min[-max]`` * - ``-o``, ``--output=OUT`` - File for batch script's standard output, default is a file in your current working directory * - ``-p``, ``--partition=PARTITION`` - Partition requested, default is ``any`` * - ``--pty`` - Execute task in pseudo terminal mode (required for parallel shell) * - ``-t``, ``--time`` - Time limit, default depends on partition configuration Examples ^^^^^^^^ Run the ``hostname`` command in 4 parallel tasks distributed on 4 distinct nodes:: $ srun --ntasks=4 --tasks-per-node=1 hostname -f e1wn2.pi.infn.it e1wn1.pi.infn.it e1wn4.pi.infn.it e1wn3.pi.infn.it Start an interactive parallel shell:: $ srun --ntasks=1 --cpus-per-task=4 --pty /bin/bash Queue Monitoring (``squeue``) ----------------------------- View information about jobs located in the Slurm scheduling queue. **Usage:** ``squeue [OPTIONS...] EXECUTABLE [ARGS...]`` Options ^^^^^^^ .. list-table:: :header-rows: 1 :widths: 30 70 * - Option - Description * - ``-A``, ``--account=ACCOUNT(S)`` - Comma separated list of accounts to view, default is all accounts * - ``-l``, ``--long`` - Long report * - ``-p``, ``--partition=PARTITION(S)`` - Comma separated list of partitions to view, default is all partitions * - ``-u``, ``--user=USER_NAME(S)`` - Comma separated list of users to view, Examples ^^^^^^^^ List all queued jobs for user ``johndoe``:: $ squeue --user=johndoe JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) 4299 levante s1g2_int johndoe PD 0:00 1 (ReqNodeNotAvail, UnavailableNodes:e1wn6) 4259 levante s1g1_int johndoe PD 0:00 1 (ReqNodeNotAvail, UnavailableNodes:e1wn6) 4302 levante s1g2_int johndoe R 1:08:27 1 e1wn9 4307 levante s1g2_int johndoe R 1:08:27 1 e1wn14 4262 levante s1g1_int johndoe R 1:22:40 1 e1wn9 4267 levante s1g1_int johndoe R 1:22:40 1 e1wn14 List all jobs queued on the ``levante`` partition:: $ squeue -p levante JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) 4299 levante s1g2_int johndoe PD 0:00 1 (ReqNodeNotAvail, UnavailableNodes:e1wn6) 4259 levante s1g1_int johndoe PD 0:00 1 (ReqNodeNotAvail, UnavailableNodes:e1wn6) 4101 levante dessis_j neo R 5:40:53 1 e1wn1 4302 levante s1g2_int johndoe R 1:10:33 1 e1wn9 4307 levante s1g2_int johndoe R 1:10:33 1 e1wn14 4262 levante s1g1_int johndoe R 1:24:46 1 e1wn9 4267 levante s1g1_int johndoe R 1:24:46 1 e1wn14 Accounting (``sacct``) --------------------------- Displays accounting data for all jobs in the Slurm database. **Usage:** ``sacct [OPTIONS...]`` Options ^^^^^^^ .. list-table:: :header-rows: 1 :widths: 30 70 * - Option - Description * - ``-A``, ``--account=ACCOUNT(S)`` - Comma separated list of accounts to view, default is all accounts * - ``-E``, ``--endtime=TIME`` - Select jobs eligible before this time * - ``-j``, ``--jobs=JOB(S)`` - Display information about this job or comma-separated list of jobs, default is all jobs * - ``-l``, ``--long`` - Long report * - ``-r``, ``--partition=PARTITION(S)`` - Comma separated list of partitions to select jobs from, default is all partitions * - ``-S``, ``--starttime=TIME`` - Select jobs eligible after this time, default is 00:00:00 of the current day * - ``-s``, ``--state=STATE`` - Select jobs based on their current state or the state they were in during the time period given * - ``-u``, ``--user=USER_NAME(S)`` - Comma separated list of users to view, .. Hint:: Valid start/end time formats are: ``HH:MM[:SS] [AM|PM]``, ``MMDD[YY]``, ``MM/DD[/YY]``, ``MM.DD[.YY]``, ``MM/DD[/YY]-HH:MM[:SS]``, ``YYYY-MM-DD[THH:MM[:SS]]``, ``now[{+|-}count[seconds(default)|minutes|hours|days|weeks]]``. .. Hint:: Valid job states are: ``running`` (``r``), ``completed`` (``cd``), ``failed`` (``f``), ``timeout`` (``to``), ``resizing`` (``rs``), ``deadline`` (``dl``) and ``node_fail`` (``nf``). Examples ^^^^^^^^ List all jobs of user ``neo`` that are in ``running`` state:: $ sacct --user=neo --state=running JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) 4318 levante dessis_j neo R 8:28:47 1 e1wn1 4319 levante sys/dash neo R 1:33:43 1 e1wn1 List all completed jobs in partition ``levante`` since January 15:: $ sacct --partition=levante --state=completed --starttime=01.15 --endtime=now JobID JobName Partition Account AllocCPUS State ExitCode ------------ ---------- ---------- ---------- ---------- ---------- -------- 3871 bash levante default 8 COMPLETED 0:0 3871.extern extern default 8 COMPLETED 0:0 3871.0 bash default 8 COMPLETED 0:0 3954 MATLAB_R2+ levante default 1 COMPLETED 0:0 3954.batch batch default 1 COMPLETED 0:0 3954.extern extern default 1 COMPLETED 0:0 Show configuration (``scontrol``) --------------------------- View or modify configuration and state of Slurm entities. **Usage:** ``scontrol show [ENTITY=ID]`` Examples ^^^^^^^^ Get info about a specific node:: $ scontrol show node e1wn1 NodeName=e1wn1 Arch=x86_64 CoresPerSocket=96 CPUAlloc=154 CPUEfctv=384 CPUTot=384 CPULoad=1.34 AvailableFeatures=CPU_MNF:AMD,CPU_GEN:GENOA,CPU_SKU:9654,CPU_FRQ:3.70GHz,IB:NDR ActiveFeatures=CPU_MNF:AMD,CPU_GEN:GENOA,CPU_SKU:9654,CPU_FRQ:3.70GHz,IB:NDR ... Get submission options of a job:: $ scontrol show job 12291 JobId=12291 JobName=bash UserId=afiori(4136) GroupId=piusers(1144) MCS_label=N/A Priority=225 Nice=0 Account=default QOS=low_prio JobState=RUNNING Reason=None Dependency=(null) Requeue=1 Restarts=0 BatchFlag=0 Reboot=0 ExitCode=0:0 RunTime=00:34:51 TimeLimit=1-00:00:00 TimeMin=N/A SubmitTime=2026-04-27T14:53:09 EligibleTime=2026-04-27T14:53:09 ...