TABLE OF CONTENTS


::pwtk::SLURM

PURPOSE

The master command for the SLURM batch queuing. It manages the submission to SLURM.

USAGE

     SLURM { ...script code... }
     SLURM file.pwtk
 or
     SLURM options { ...script code... }
     SLURM options file.pwtk
 or
     SLURM profile ?options? { ...script code... }
     SLURM profile ?options? file.pwtk

DESCRIPTION

The above "profile" is a user defined profile for SLURM, i.e., a set of #SBATCH directives, whereas the above "options" are the Slurm options, specified with the Slurm syntax, supporting short and long options, i.e.:

     -N2 --tasks=32 -t 06:00:00 ...

Note that short options can be specified as, e.g., -N2 or -N 2, whereas long options are specified as, e.g., --nodes=2

BEWARE

Note that Tcl uses different quoting than shell. Therefore, option values which contain whitespaces and square bractets are specified differently. For example, the equivalence for the shell command:

      sbatch -n2 --nodelist="node1, node2, node3" ...
      sbatch -n2 --nodelist="node[1-3]" ...

in PWTK is:

      SLURM -n2 {--nodelist=node1, node2, node3} ...
      SLURM -n2 {--nodelist=node[1-3]} ...

or

      SLURM -n2 "--nodelist=node1, node2, node3" ...
      SLURM -n2 "--nodelist=node\[1-3\]" ...

FURTHER DESCRIPTION

Here is an example of the usage of the SLURM command:

   SLURM --nodes=1 --ntasks=4  { import job.pwtk }      (N.B. ...script code... version)

or

   SLURM --nodes=1 --ntasks=4  job.pwtk                 (N.B. file.pwtk version)

If "profile" is omitted, the "default" profile is used, which is guaranteed to exist because it is defined in the $PWTK/config/slurm.tcl file.

Here is an example of two user defined profiles, named "parallel" and "long":

    slurm_profile parallel {
        #!/bin/sh
        #SBATCH --nodes=1
        #SBATCH --ntasks=16
        #SBATCH --time=6:00:00
        #SBATCH --partition=parallel
    }
    
    slurm_profile long {
        #!/bin/sh
        #SBATCH --nodes=1
        #SBATCH --ntasks=64
        #SBATCH --time=2-00:00:00
        #SBATCH --partition=long
    }

It is a good practice to also define the PWTK specifics (aka pwtk_profile) associated with the SLURM profiles. For example, for the above "long" profile with --ntasks=64, it would be reasonable to use "mpirun -n 64" as a default. This can be achieved with:

    slurm_pwtk_profile longpar { prefix mpirun -n 64 }

There is also a compact version which defines the SLURM profile and the associated PWTK profile simultaneously, i.e.:

    slurm_profile long {
        #!/bin/sh
        #SBATCH --nodes=1
        #SBATCH --ntasks=64
        #SBATCH --time=2-00:00:00
        #SBATCH --partition=longpar
    } {
        prefix mpirun -n 64
    }

Here, the 2nd argument to the 'slurm_profile' command is the SLURM profile and the last argument is the associated PWTK profile. This form is recommended because it avoid typos/mismatches between profile and pwtk_profile names.

IMPORTANT

A typical place where to store SLURM profiles for frequent use is in the ~/.pwtk/slurm.tcl configuration file (N.B. in the ~/.pwtk/slurm.tcl configuration file, the prefix 'slurm_' can be omitted).

FURTHER DESCRIPTION

The 'slurm_profile' command can be used to define profiles on the fly within the PWTK script, e.g.:

   slurm_profile n24 {
        #!/bin/sh
        #SBATCH --nodes=2
        #SBATCH --ntasks-per-node=12
        #SBATCH --ntasks=24
        #SBATCH --time=12:00:00
   } {
        prefix mpirun -np 24
   }

   SLURM n24 job.pwtk

The final effect of the SLURM command is to submit either the script code encapsulated inside the SLURM { ... } command or the script file specified with the SLURM command (e.g. SLURM file.pwtk) to the Slurm job scheduling system via the sbatch command.