Example 5-18 Environment Variables Available in a Batch Job Script

$ cat ./envscript.sh #!/bin/sh name=`hostname`

echo "hostname = $name"

echo "LSB_HOSTS = '$LSB_HOSTS'"

echo "LSB_MCPU_HOSTS = '$LSB_MCPU_HOSTS'" echo "SLURM_JOBID = $SLURM_JOBID"

echo "SLURM_NPROCS = $SLURM_NPROCS" $ bsub -n4-I ./envscript.sh

Job <82> is submitted to default queue <normal>. <<Waiting for dispatch ...>>

<<Starting on lsfhost.localdomain>> hostname = n1

LSB_HOSTS = 'n1 n1 n2 n2' LSB_MCPU_HOSTS = 'n1 2 n2 2' SLURM_JOBID = 176 SLURM_NPROCS = 4

5.5 Submitting Multiple MPI Jobs Across the Same Set of Nodes

There are two ways to run multiple MPI jobs across the same set of nodes at the same time; they are:

Using a scriptUsing a Makefile

The following sections show these methods. In both methods, the jobs submitted are parallel jobs using the HP-MPI message passing interface and use the ping_pong_ring program, which is delivered with the HP-MPI software.

5.5.1 Using a Script to Submit Multiple Jobs

You can write a script that consists of multiple commands that launch jobs. In this example, the ping_pong_ring command is run first in the background then again in the foreground:

$ cat script #!/bin/sh

mpirun -srun -N2 -n4 ./ping_pong_ring 100000 & mpirun -srun -N2 -n4 ./ping_pong_ring 100000

The following command line executes the script, which submits the jobs:

$ bsub -o %J.out -n2 -ext "SLURM[nodes=2]" ./script Job <111> is submitted to default queue <normal>.

The bjobs command provides information on the execution of the script:

$ bjobs

 

 

 

 

 

 

 

JOBID

USER

STAT

QUEUE

FROM_HOST

EXEC_HOST

JOB_NAME

SUBMIT_TIME

111

lsfadmi PEND

normal

lsfhost.loc

 

./script

date and time

Use the squeue command to acquire information on the jobs:

$ squeue

-s

 

 

 

STEPID

NAME

PARTITION

USER

TIME NODELIST

13.0

hptclsf@111

lsf

lsfadmin

0:07 n14

13.1

ping_pong_ring

lsf

lsfadmin

0:07 n[14-15]

13.2

ping_pong_ring

lsf

lsfadmin

0:07 n[14-15]

$ bjobs

 

 

 

 

No unfinished job found

5.5.2 Using a Makefile to Submit Multiple Jobs

You can submit multiple jobs across the same nodes by using a Makefile.

For information on Makefiles and the make utility, see The GNU Make Manual and make(1L).

58 Submitting Jobs