Example 5-13 Using the External Scheduler to Constrain Launching to Nodes with a Given Feature

$ bsub -n 10 -ext "SLURM[constraint=dualcore]" -I srun hostname

You can use the bqueues command to determine the SLURM scheduler options that apply to jobs submitted to a specific LSF queue, for example:

$ bqueues -l dualcore grep SLURM

MANDATORY_EXTSCHED: SLURM[constraint=dualcore]

5.4 Submitting a Batch Job or Job Script

Use the following bsub command format to submit a batch job or job script:

bsub -nnum-procs [bsub-options]script-name

The -nnum-procsparameter, which is required for parallel jobs, specifies the number of cores the job requests.

The script-nameargument is the name of the batch job or script. The script can contain one or more srun or mpirun commands.

The script will execute once on the first allocated node, and the srun or mpirun commands within the script will be run on the allocated compute nodes.

In Example 5-14, a simple script named myscript.sh, which contains two srun commands, is displayed then submitted.

Example 5-14 Submitting a Job Script

$ cat myscript.sh #!/bin/sh

srun hostname mpirun -srun hellompi $ bsub -I-n4 myscript.sh

Job <29> is submitted to

default queue <normal>.

<<Waiting for

dispatch ...>>

 

<<Starting on

lsfhost.localdomain>>

n2

 

 

 

 

n2

 

 

 

 

n4

 

 

 

 

n4

 

 

 

 

Hello world!

I'm 0

of 4

on

n2

Hello world!

I'm 1

of 4

on

n2

Hello world!

I'm 2

of 4

on

n4

Hello world!

I'm 3

of 4

on

n4

 

 

 

 

 

Example 5-15runs the same script but uses the LSF-SLURM External Scheduler option to specify different resources (here, 4 compute nodes).

56 Submitting Jobs