Batch Jobs Slurm- ForHLR Features

From KIT HPC Wiki
Jump to: navigation, search

This article contains information on the queues of the batch job system and on interactive jobs.

1 Job Submission

1.1 sbatch Command

1.1.1 sbatch -p queue

Compute resources such as (wall-)time, nodes and memory are restricted and must fit into queues. Since requested compute resources are NOT always automatically mapped to the correct queue class, you must add the correct queue class to your sbatch command . 'The specification of a queue is obligatory on ForHLR II.
Details are:

sbatch -p queue
queue node default resources minimum resources maximum resources
develop thin time=10, ntasks=1, mem=60000mb, mem-per-cpu=3000mb nodes=1 time=60, nodes=4, ntasks-per-node=20
4 nodes are reserved for this queue
Only for development, i.e. debugging or performance optimization ...
develop-visu fat time=10, ntasks=1, mem=1027200mb, mem-per-cpu=21400mb nodes=1 time=120, nodes=1, ntasks-per-node=48
1 node is reserved for this queue
Only for development, i.e. debugging or performance optimization ...
normal thin walltime=10, ntasks=1, mem=60000mb, mem-per-cpu=3000mb nodes=1 time=3-00:00:00, nodes=256, ntasks-per-node=20
long thin time=3-00:00:01, ntasks=1, mem=60000mb, mem-per-cpu=3000mb nodes=1 time=7-00:00:00, nodes=64, ntasks-per-node=20
xnodes thin time=10, ntasks=257, mem=60000mb, mem-per-cpu=3000mb nodes=257 time=3-00:00:00, nodes=512, ntasks-per-node=20
visu visu time=10, ntasks=1, mem=1027200mb, mem-per-cpu=21400mb nodes=1 time=3-00:00:00, nodes=4, ntasks-per-node=48

Default resources of a queue class defines time, #tasks and memory if not explicitly given with sbatch command. Resource list acronyms --time, --ntasks, --nodes, --mem and --mem-per-cpu are described here. Queue class examples

To run your batch job on one of the fat nodes, please use:

$ sbatch --partition=develop
$ sbatch -p develop Interactive Jobs

On ForHLR II you are only allowed to run short jobs (<< 1 hour) with little memory requirements (<< 8 GByte) on the logins nodes. If you want to run longer jobs and/or jobs with a request of more than 8 GByte of memory, you must allocate resources for so-called interactive jobs by usage of the command salloc on a login node. Considering a serial application running on a compute node that requires 5000 MByte of memory and limiting the interactive run to 2 hours the following command has to be executed:

$ salloc -p normal -n 1 -t 120 --mem=5000

Then you will get one core on a compute node within the partition "normal". After execution of this command DO NOT CLOSE your current terminal session but wait until the queueing system Slurm has granted you the requested resources on the compute system. You will be logged in automatically on the granted core! To run a serial program on the granted core you only have to type the name of the executable.

$ ./<my_serial_program>

Please be aware that your serial job must run less than 2 hours in this example, else the job will be killed during runtime by the system.
You can also start now a graphical X11-terminal connecting you to the dedicated resource that is available for 2 hours. You can start it by the command:

$ xterm

Note that, once the walltime limit has been reached the resources - i.e. the compute node - will automatically be revoked.
An interactive parallel application running on one compute node or on many compute nodes (e.g. here 5 nodes) with 20 cores each requires usually an amount of memory in GByte (e.g. 50 GByte) and a maximum time (e.g. 1 hour). E.g. 5 nodes can be allocated by the following command:

$ salloc -p normal -N 5 --ntasks-per-node=20 -t 01:00:00  --mem=50gb

Now you can run parallel jobs on 100 cores requiring 50 GByte of memory per node. Please be aware that you will be logged in on core 0 of the first node. If you want to run MPI-programs, you can do it by simply typing mpirun <program_name>. Then your program will be run on 100 cores. A very simple example for starting a parallel job can be:

$ mpirun <my_mpi_program>

You can also start the debugger ddt by the commands:

$ module add devel/ddt
$ ddt <my_mpi_program>

The above commands will execute the parallel program <my_mpi_program> on all available cores. You can also start parallel programs on a subset of cores; an example for this can be:

$ mpirun -n 50 <my_mpi_program>

If you are using Intel MPI you must start <my_mpi_program> by the command mpiexec.hydra (instead of mpirun).

2 Accounting

By executing the command

$ sacctmgr [-p] list assoc

the granted CPU-minutes for all projects you are involved in can be seen. The value is stored in the column below GrpTRESMins. Additionally you can see below GrpSubmit how many jobs can be submitted concurrently by all users of a project and below GrpJobs how many jobs can be submitted concurrently by a single user of a project. The command sacctmgr is explained in detail on the webpage or via manpage (man sacctmgr).

By executing the command

# Accumulation of all jobs since 01/18/2019 (end of maintenance) on ForHLR II
$ sreport [-p] --tres cpu cluster AccountUtilizationByUser Start=2019-01-18 [-t hours]

the used CPU-minutes since 01/18/2019 for all projects you are involved in can be seen. The value is stored in the column below used. If you don't insert the option END, the accumulation of CPU-time will end yesterday at 23:59. You can add an arbitrary end by the option END=MM/DD[/YY]-HH:MM[:SS]. If you omit the options START and END, you will get the accumulated cpu-times of yesterday. Using the option -t hours means to get the used CPU-time in hours. The command sreport is explained in detail on the webpage or via manpage (man sreport).

If the used CPU-times of a project are higher than the granted cpu-time, your submitted jobs will not run. The jobs will be pending in the queue until the granted CPU-time has been enhanced. If you execute the command squeue you will get the reason "AssocGrpCPUMinutesLimit" for the pending of your job.

If your account is enclosed in more than one project group, you must set the option -A <project_group> of the command sbatch for adding the CPU time to the project <project_group>. Otherwise the mapping of CPU time to a project is random.