Changes between Version 8 and Version 9 of Public/User_Guide/Batch_system


Ignore:
Timestamp:
Nov 7, 2017, 1:31:33 PM (7 years ago)
Author:
Peter Niessen
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Public/User_Guide/Batch_system

    v8 v9  
    55Please confer /etc/slurm/README.
    66
    7 
    87== Overview ==
    98
     9Slurm offers interactive and batch jobs (scripts submitted into the system). The relevant commands are {{{srun}}} and {{{sbatch}}}. The {{{srun}}} command can be used to spawn processes ('''please do not use mpiexec'''), both from the frontend and from within a batch script. You can also get a shell on a node to work locally there (e.g. to compile your application natively for a special platform.
     10
     11== An introductory example ==
     12
     13Suppose you have an mpi executable named {{{hello_mpi}}}. There are three ways to start the binary.
     14
     15=== From a shell on a node ===
     16
     17First, start a shell on a node. You would like to run your mpi task on 4 machines with 2 tasks per machine:
     18{{{
     19niessen@deepl:src/mpi > srun --partition=sdv -N 4 -n 8 --pty /bin/bash -i
     20niessen@deeper-sdv04:/direct/homec/zdvex/niessen/src/mpi >
     21}}}
     22
     23The environment is transported to the remote shell, no {{{.profile}}}, {{{.bashrc}}}, ... are sourced (especially not the modules default from {{{/etc/profile.d/modules.sh}}}).
     24
     25Once you get to the compute node, start your application using {{{srun}}}. Note that the number of tasks used is the same as specified in the initial {{{srun}}} command above (4 nodes with two tasks each):
     26{{{
     27niessen@deeper-sdv04:/direct/homec/zdvex/niessen/src/mpi > srun ./hello_cluster
     28srun: cluster configuration lacks support for cpu binding
     29Hello world from process 6 of 8 on deeper-sdv07
     30Hello world from process 7 of 8 on deeper-sdv07
     31Hello world from process 3 of 8 on deeper-sdv05
     32Hello world from process 4 of 8 on deeper-sdv06
     33Hello world from process 0 of 8 on deeper-sdv04
     34Hello world from process 2 of 8 on deeper-sdv05
     35Hello world from process 5 of 8 on deeper-sdv06
     36Hello world from process 1 of 8 on deeper-sdv04
     37}}}
     38
     39You can ignore the warning about the cpu binding. ParaStation will pin you processes.
     40
     41=== Running directly from the front ends ===
     42
     43You can run the application directly from the frontend, bypassing the shell:
     44
     45{{{
     46niessen@deepl:src/mpi > srun --partition=sdv -N 4 -n 8 ./hello_cluster
     47Hello world from process 4 of 8 on deeper-sdv06
     48Hello world from process 6 of 8 on deeper-sdv07
     49Hello world from process 3 of 8 on deeper-sdv05
     50Hello world from process 0 of 8 on deeper-sdv04
     51Hello world from process 2 of 8 on deeper-sdv05
     52Hello world from process 5 of 8 on deeper-sdv06
     53Hello world from process 7 of 8 on deeper-sdv07
     54Hello world from process 1 of 8 on deeper-sdv04
     55}}}
     56
     57In this case, it can be useful to create an allocation which you can use for several runs of your job:
     58
     59{{{
     60niessen@deepl:src/mpi > salloc --partition=sdv -N 4 -n 8
     61salloc: Granted job allocation 955
     62niessen@deepl:~/src/mpi>srun ./hello_cluster
     63Hello world from process 3 of 8 on deeper-sdv05
     64Hello world from process 1 of 8 on deeper-sdv04
     65Hello world from process 7 of 8 on deeper-sdv07
     66Hello world from process 5 of 8 on deeper-sdv06
     67Hello world from process 2 of 8 on deeper-sdv05
     68Hello world from process 0 of 8 on deeper-sdv04
     69Hello world from process 6 of 8 on deeper-sdv07
     70Hello world from process 4 of 8 on deeper-sdv06
     71niessen@deepl:~/src/mpi> # several more runs
     72...
     73niessen@deepl:~/src/mpi>exit
     74exit
     75salloc: Relinquishing job allocation 955
     76}}}
     77
     78=== Batch script ===
     79
     80Given the following script {{{hello_cluster.sh}}}: (it has to be executable):
     81
     82{{{
     83#!/bin/bash
     84
     85#SBATCH --partition=sdv
     86#SBATCH -N 4
     87#SBATCH -n 8
     88#SBATCH -o /homec/zdvex/niessen/src/mpi/hello_cluster-%j.log
     89#SBATCH -e /homec/zdvex/niessen/src/mpi/hello_cluster-%j.err
     90#SBATCH --time=00:10:00
     91
     92srun ./hello_cluster
     93}}}
     94
     95This script requests 4 nodes with 8 tasks, specifies the stdout and stderr files, and asks for 10 minutes of walltime. Submit:
     96
     97{{{
     98niessen@deepl:src/mpi > sbatch ./hello_cluster.sh
     99Submitted batch job 956
     100}}}
     101
     102Check what it's doing:
     103
     104{{{
     105niessen@deepl:src/mpi > squeue
     106             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
     107               956       sdv hello_cl  niessen  R       0:00      4 deeper-sdv[04-07]
     108}}}
     109
     110Check the result:
     111
     112{{{
     113niessen@deepl:src/mpi > cat hello_cluster-956.log
     114Hello world from process 5 of 8 on deeper-sdv06
     115Hello world from process 1 of 8 on deeper-sdv04
     116Hello world from process 7 of 8 on deeper-sdv07
     117Hello world from process 3 of 8 on deeper-sdv05
     118Hello world from process 0 of 8 on deeper-sdv04
     119Hello world from process 2 of 8 on deeper-sdv05
     120Hello world from process 4 of 8 on deeper-sdv06
     121Hello world from process 6 of 8 on deeper-sdv07
     122}}}
     123
    10124== Available Partitions ==
    11125
     126Please note that there is no default partition configured. In order to run a job, you have to specify one of the following partitions, using the {{{--partition=...}}} switch:
     127
     128 * cluster: The old DEEP cluster nodes {{{deep[001-128]}}}
     129 * sdv: The DEEP-ER sdv nodes
     130 * knl: The DEEP-ER knl nodes (all of them, regardless of cpu and configuration)
     131 * knl256: the 256-core knls
     132 * knl272: the 272-core knls
     133 * snc4: the knls configured in SNC-4 mode
     134 * knm: The DEEP-ER knm nodes
     135 * extoll: the sdv and knl nodes in the extoll fabric
     136
     137Anytime, you can list the state of the partitions with the {{{sinfo}}} command. The properties of a partition can be seen using
     138
     139{{{
     140scontrol show partition <partition>
     141}}}
     142
    12143== Interactive Jobs ==
    13144
     
    18149=== Why's my job not running? ===
    19150
     151You can check the state of your job with
     152
     153{{{
     154scontrol show job <job id>
     155}}}
     156
     157In the output, look for the {{{Reason}}} field.
     158
     159You can check the existing reservations using
     160
     161{{{
     162scontrol show res
     163}}}
     164
    20165=== How can I check which jobs are running in the machine? ===
    21166
     167Please use the {{{squeue}}} command.
     168
    22169=== How do I do chain jobs with dependencies? ===
    23170
     171Please confer the {{{sbatch}}}/{{{srun}}} man page, especially the
     172
     173{{{
     174-d, --dependency=<dependency_list>
     175}}}
     176
     177entry.
     178
    24179=== How can get a list of broken nodes? ===
    25180
     181The command to use is
     182
     183{{{
     184sinfo -Rl -h -o "%n %12U %19H %6t %E" | sort -u
     185}}}
     186
     187See also the translation table below.
     188
    26189=== Can I still use the old DEEP Booster nodes? ===
    27190
     191Yes, please use
     192
     193{{{
     194qsub -q booster ...
     195}}}
     196
     197You cannot run a common job on both the old DEEP cluster and DEEP booster.
     198
    28199=== Can I join stderr and stdout like it was done with {{{-joe}}} in Torque? ===
    29200
     201Not directly. In your batch script, redirect stdout and stderr to the same file:
     202
     203{{{
     204...
     205#SBATCH -o /point/to/the/common/logfile-%j.log
     206#SBATCH -e /point/to/the/common/logfile-%j.log
     207...
     208}}}
     209
     210(The {{{%j}}} will place the job id in the output file). N.B. It might be more efficient to redirect the output of your script's commands to a dedicated file.
     211
    30212=== What's the equivalent of {{{qsub -l nodes=x:ppn=y:cluster+n_b:ppn=p_b:booster}}}? ===
     213
     214
    31215
    32216== pbs/slurm dictionary ==