# Resource Manager - SLURM ::::::{tab-set} :sync-group: lang :class: lang-tabs :::::{tab-item} En :sync: en Multitasking and the scheduling of computing resources according to the prescribed job policy are handled by the system software SLURM (Simple Linux Utility for Resource Managment). Parallel jobs are usually described in shell scripts. Typically, all control is done from the command line. The most common commands are: 1. sbatch ime-posla.slurm 2. squeue 3. scancel ime-ali-številka-posla The first command runs the program with the parameters prescribed in the script. If several identical programs are run with different input data, you must ensure that the results are written to separate files. The second command shows the current state of the user's job queue. When a job starts depends on the state of all jobs on the supercomputer. The third command stops a running job and removes it from the queue. In addition to these most frequently used commands, there are other commands for monitoring the state of SLURM and user accounts in more detail. ## Job execution flow ![](../files/u3/job_cycle.gif) 1. Job submission - From the login node (or elsewhere), a request to run the job is sent with the sbatch (or srun) command 2. Queueing - SLURM on the control node examines the possibilities for running the job and starts it as soon as possible 3. Job dispatch - The control node sends the job to free compute nodes 4. Running the job on the compute nodes 5. Returning results in the form of program output ## Using SLURM Run a command on X nodes with Y cores: `srun -N X -n Y ukaz` Submit a script to the queue: `sbatch skripta.sh` Start an interactive session: `srun --pty bash -i` Check the status of unfinished jobs: `squeue` Summarise occupancy by queue: `sinfo` Check the history of today's jobs `sacct` Check the history of all jobs from a given date onwards: `sacct --starttime 2019-05-01 --format=User,JobID,Jobname,partition,state,time,start,end,elapsed,MaxRSS,MaxVMSize,ReqMem,nnodes,ncpus,nodelist` More usage examples are available at ## Node usage overview Usage can be checked at in the "Telegraf metrics" view. Under "server", select the desired nodes. ## Scripts [HPCFS wiki: slurm](../wiki/slurm.md) ::::: :::::{tab-item} Slo :sync: sl **Nadzornik računskih virov - SLURM** Za večopravilnost in razporejanje računskih virov glede na predpisano politiko poslov skrbi sistemska programska oprema SLURM (Simple Linux Utility for Resource Managment). Vzporedni posli se običajno popisujejo v skriptah ukazne školjke. Običajno je, da se celoten nadzor opravlja iz ukazne vrstice. Najbolj pogosti ukazi so: 1. sbatch ime-posla.slurm 2. squeue 3. scancel ime-ali-številka-posla S prvim ukazom zaženemo program s predpisanimi parametri v skripti. Če poganjamo več istih programov z različnimi vhodnimi podatki, je potrebno zagotoviti, da se rezultati pišejo v ločene datoteke. Drugi ukaz prikazuje trenutno stanje čakalne vrste poslov uporabnika. Kdaj se požene kakšen posel je odvisno od stanja vseh poslov na superračunalniku. Tretji ukaz ustavi delujoči posel in ga izbriše iz vrste. Poleg navedenih najbolj uporabljanih ukazov obstajajo še ukazi, s katerimi lahko podrobneje spremljano stanje SLURM in uporabniških računov. ## Potek izvajanja poslov ![](../files/u3/job_cycle.gif) 1. Vzpostavitev posla - Z nadzornega vozlišča (lahko tudi od drugje) z ukazom sbatch (ali srun) pošljemo zahtevo za izvajanje posla 2. Uvrstitev v čakalno vrsto - SLURM na nadzornem vozlišču preuči možnosti za izvajanje posla in ga požene takoj, ko je to mogoče 3. Razvrstitev posla - Nadzorno vozlišče pošlje posel na prosta računska vozlišča 4. Poganjanje posla na računskih vozliščih 5. Vračanje rezultatov  v obliki izpisa programa ## Uporaba SLURM-a Poženi ukaz na X vozliščih z Y jedri: `srun -N X -n Y ukaz` Vstavi v čakalno vrsto skripto: `sbatch skripta.sh` Zaženi interaktivno sejo: `srun --pty bash -i` Preveri stanje nedokončanih poslov: `squeue` Povzemi zasedenost po čakalnih vrstah: `sinfo` Preveri zgodovino današnjih jobov `sacct` Preveri zgodovino vseh jobov: od datuma naprej: `sacct --starttime 2019-05-01 --format=User,JobID,Jobname,partition,state,time,start,end,elapsed,MaxRSS,MaxVMSize,ReqMem,nnodes,ncpus,nodelist` Več primerov uporabe na voljo na ## Pregled porabe vozlišč Porabo lahko preverite na na pogledu "Telegraf metrics". Pod "server" izberete željena vozlišča. ## Skripte [HPCFS wiki: slurm](../wiki/slurm.md) ::::: ::::::