Example 2-5: Running an MPI Job with LSF Using the External Scheduler Option (cont.)

Hello world! I’m 2 of 4 on host2

Hello world! I’m 3 of 4 on host3

Hello world! I’m 4 of 4 on host4

2.3.5.4 Submitting a Batch Job or Job Script

Submitting batch jobs is discussed in detail in Section 7.4.6. The bsub command format to submit a batch job or job script is:

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

The -nnum-procsoption specifies the number of processors the job requests. The -nnum-procsis required for parallel jobs.

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.

Consider an HP XC configuration where lsfhost.localdomain is the LSF execution host and nodes n[1-10]are compute nodes in the LSF partition. All nodes contain 2 processors, providing 20 processors for use by LSF jobs.

In this example, the following simple script myjobscript.sh is launched. Two srun commands are specified within the script.

Example 2-6: Submitting a Job Script

#!/bin/sh srun hostname

mpirun -srun hellompi

The following command submits this script:

$ bsub -I -n4 myjobscript.sh

The -n4option specifies that four processors are required. The -Ioption specifies that the job is interactive and directs output to the terminal screen. The following output is displayed:

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

Using the System 2-11