![](/images/new-backgrounds/1153000/153000115x1.webp)
Example
$ 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
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 script
•Using a Makefile
The following sections show these methods. In both methods, the jobs submitted are parallel jobs using the
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
The following command line executes the script, which submits the jobs:
$ bsub
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 |
|
|
| |
STEPID | NAME | PARTITION | USER | TIME NODELIST |
13.0 | hptclsf@111 | lsf | lsfadmin | 0:07 n14 |
13.1 | ping_pong_ring | lsf | lsfadmin | 0:07 |
13.2 | ping_pong_ring | lsf | lsfadmin | 0:07 |
$ 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