compute_slurm
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
compute_slurm [2020/09/24 13:58] – pgh5a | compute_slurm [2023/11/10 14:52] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ==== Scheduling a Job using the SLURM job scheduler ==== | ||
+ | |||
+ | {{ :: | ||
+ | |||
+ | The Computer Science Department uses a "job scheduler" | ||
+ | |||
+ | The job scheduler supports a direct login option (see below) that allows direct interactive logins to servers controlled by the scheduler, without the need for a job script. | ||
+ | |||
+ | ===== Updates ===== | ||
+ | * As of 10-Jan-2022, | ||
+ | |||
+ | * As of 02-Apr-2022, | ||
+ | |||
+ | * As of 23-Aug-2023, | ||
+ | |||
+ | * As of 26-Sep-2023, | ||
+ | * Reservations may circumvent this limit by using the QoS '' | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Using SLURM ==== | ||
+ | **[[https:// | ||
+ | |||
+ | The SLURM commands below are ONLY available on the portal cluster of servers. They are not installed on the gpusrv* or the SLURM controlled nodes themselves. | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Information Gathering ==== | ||
+ | |||
+ | To view information about compute nodes in the SLURM system, use the command '' | ||
+ | |||
+ | < | ||
+ | [abc1de@portal04 ~]$ sinfo | ||
+ | PARTITION AVAIL TIMELIMIT | ||
+ | main* up | ||
+ | main* up | ||
+ | gpu up | ||
+ | gpu up | ||
+ | gpu up | ||
+ | </ | ||
+ | |||
+ | With '' | ||
+ | |||
+ | To view jobs running on the queue, we can use the command '' | ||
+ | |||
+ | < | ||
+ | abc1de@portal01 ~ $ squeue | ||
+ | JOBID PARTITION | ||
+ | 467039 | ||
+ | </ | ||
+ | |||
+ | and now that a node has been allocated, that node '' | ||
+ | |||
+ | < | ||
+ | abc1de@portal01 ~ $ sinfo | ||
+ | PARTITION | ||
+ | main* up | ||
+ | main* up | ||
+ | qdata up | ||
+ | qdata-preempt | ||
+ | falcon | ||
+ | intel up | ||
+ | amd up | ||
+ | </ | ||
+ | |||
+ | You can also see what resources (such as GPUs) that a node has available by running the command '' | ||
+ | |||
+ | < | ||
+ | abc1de@portal01 ~$ scontrol show node ai10 | ||
+ | NodeName=ai10 Arch=x86_64 CoresPerSocket=8 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Jobs ==== | ||
+ | |||
+ | To use SLURM resources, you must submit your jobs (program/ | ||
+ | |||
+ | Users can submit SLURM jobs from '' | ||
+ | |||
+ | Here is our script, all it does is print the hostname of the server running the script. | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | # --- this job will be run on any available node | ||
+ | # and simply output the node's hostname to | ||
+ | # my_job.output | ||
+ | #SBATCH --job-name=" | ||
+ | #SBATCH --error=" | ||
+ | #SBATCH --output=" | ||
+ | echo " | ||
+ | </ | ||
+ | |||
+ | We run the script with '' | ||
+ | |||
+ | < | ||
+ | [abc1de@portal04 ~]$ sbatch slurm.test | ||
+ | Submitted batch job 640768 | ||
+ | [abc1de@portal04 ~]$ more my_job.output | ||
+ | cortado06 | ||
+ | </ | ||
+ | |||
+ | Here is a similar example using '' | ||
+ | |||
+ | < | ||
+ | abc1de@portal01 ~ $ srun -w slurm[1-5] -N5 hostname | ||
+ | slurm4 | ||
+ | slurm1 | ||
+ | slurm2 | ||
+ | slurm3 | ||
+ | slurm5 | ||
+ | </ | ||
+ | |||
+ | If the node to be used is NOT in the main (default) " | ||
+ | |||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | # --- this job will be run on any available node in the " | ||
+ | # and simply output the node's hostname to | ||
+ | # my_job.output | ||
+ | #SBATCH --job-name=" | ||
+ | #SBATCH --error=" | ||
+ | #SBATCH --output=" | ||
+ | # --- specify the partition (queue) name | ||
+ | #SBATCH --partition=" | ||
+ | echo " | ||
+ | </ | ||
+ | |||
+ | If you are trying to use a node that is not in the default partition, and you don't specify the partition in your job script, you will get a message from '' | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Direct login to servers (without a job script) ==== | ||
+ | |||
+ | You can use '' | ||
+ | |||
+ | We must pass the '' | ||
+ | |||
+ | For example, to open a direct login job on the node " | ||
+ | |||
+ | < | ||
+ | abc1de@portal ~$ srun -w cortado04 --pty bash -i -l - | ||
+ | abc1de@cortado04 ~$ hostname | ||
+ | cortado04 | ||
+ | abc1de@cortado04 ~$ | ||
+ | </ | ||
+ | |||
+ | The '' | ||
+ | |||
+ | If a node is in a partition (see below for partition information) other than the default " | ||
+ | < | ||
+ | abc1de@portal ~$ srun -w lynx05 -p gpu --pty bash -i -l - | ||
+ | </ | ||
+ | |||
+ | If you are using a reservation, | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Terminating Jobs ==== | ||
+ | |||
+ | Please be aware of jobs you start and make sure that they finish executing. | ||
+ | |||
+ | To cancel a running job, use the '' | ||
+ | |||
+ | < | ||
+ | abc1de@portal01 ~ $ squeue | ||
+ | JOBID PARTITION | ||
+ | 467039 | ||
+ | abc1de@portal01 ~ $ scancel 467039 | ||
+ | </ | ||
+ | |||
+ | The default signal sent to a running job is SIGTERM (terminate). If you wish to send a different signal to the job's processes (for example, a SIGKILL which is often needed if a SIGTERM doesn' | ||
+ | < | ||
+ | abc1de@portal01 ~ $ scancel --signal=KILL 467039 | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Queues/ | ||
+ | |||
+ | Slurm refers to job queues as // | ||
+ | |||
+ | If no partition is specified in your job script or when using the ' | ||
+ | |||
+ | The " | ||
+ | |||
+ | Partition is indicated by '' | ||
+ | |||
+ | To specify a partition with '' | ||
+ | |||
+ | < | ||
+ | #SBATCH --partition=gpu | ||
+ | </ | ||
+ | |||
+ | Or from the command line with '' | ||
+ | |||
+ | < | ||
+ | -p gpu | ||
+ | </ | ||
+ | |||
+ | An example running the command '' | ||
+ | |||
+ | < | ||
+ | srun -p main hostname | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Long Running Jobs ==== | ||
+ | |||
+ | If a job is expected to run longer than the default for a given partition, two other paritions with unlimited runtime named '' | ||
+ | |||
+ | The partition '' | ||
+ | |||
+ | To utilize these partitions, simply specify the name of the partition in '' | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Using GPUs ==== | ||
+ | |||
+ | Slurm handles GPUs and other non-CPU computing resources using what are called [[https:// | ||
+ | |||
+ | Say we want to use 4 GPUs on a system, we would use the following '' | ||
+ | |||
+ | < | ||
+ | #SBATCH --gres=gpu: | ||
+ | </ | ||
+ | |||
+ | Or from the command line | ||
+ | |||
+ | < | ||
+ | --gres=gpu: | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Reservations ==== | ||
+ | |||
+ | Reservations for specific resources or nodes can be made by submitting a request to < | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Job Accounting ==== | ||
+ | The SLURM scheduler implements the Accounting features of slurm. So users can execute the '' | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Using " | ||
+ | |||
+ | Due to the way '' | ||
+ | |||
+ | To fix this, simply include the following line in your sbatch scripts: | ||
+ | |||
+ | <code bash> | ||
+ | source / | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ==== Preemption ==== | ||
+ | |||
+ | The SLURM scheduler allows for preemption on certain nodes within the cluster. To view which nodes that have preemption enabled, execute the '' | ||
+ | |||
+ | If you submit a job to a node in a high prioirty partition, it is possible it will be suspended if the owner of the node or their research group submits to it while your job is running. | ||
+ | |||
+ | This does not apply if a node is reserved. | ||
+ | |||
+ | To use a high priority partition, simply specify the partition name in your '' | ||