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

Example 5-9 Submitting a Job Script

$ cat myscript.sh #!/bin/sh

srun hostname mpirun -srun hellompi

$ bsub -I -n4myscript.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-10runs the same script but uses the LSF-SLURM External Scheduler option to specify different resources (here, 4 compute nodes).

Example 5-10 Submitting a Batch Script with the LSF-SLURM External Scheduler Option

$ bsub -n4 -ext "SLURM[nodes=4]" -I ./myscript.sh

Job <79> is submitted to

default queue <normal>.

<<Waiting for

dispatch ...>>

 

<<Starting on

lsfhost.localdomain>>

n1

 

 

 

 

n2

 

 

 

 

n3

 

 

 

 

n4

 

 

 

 

Hello world!

I'm 0

of 4

on

n1

Hello world!

I'm 1

of 4

on

n2

Hello world!

I'm 2

of 4

on

n3

Hello world!

I'm 3

of 4

on

n4

Example 5-11and Example 5-12show how the jobs inside the script can be manipulated within the allocation.

Example 5-11 Submitting a Batch Job Script That Uses a Subset of the Allocation

$ bsub -n4 -ext "SLURM[nodes=4]" -I ./myscript.sh Job <80> is submitted to default queue <normal>. <<Waiting for dispatch ...>>

<<Starting on lsfhost.localdomain>> n1

n2

Hello world! I'm 0 of 2 on n1 Hello world! I'm 1 of 2 on n2

50 Submitting Jobs