0

Let's assume, I run my Open MPI application with the following command:

mpirun a.out

and I specify the number of MPI ranks by means of an LSF job scheduler script:

#BSUB -n 20

How to specify the number of MPI ranks for mpirun through some Open MPI environment variable?

The reason for my need is the following. First, I need to allocate 20 cores on a node and run 5 independent parallel jobs (1, 2, 3, 4, 10 MPI ranks). Second, I do not have an opportunity to submit these jobs as non-exclusive jobs to the same host. Third, I do not directly invoke mpirun a.out command, as it is hidden deeply inside some complex third-parth script run.sh, and that is only the run.sh script that I can explicitly execute in the job scheduler command file. That is why I would like to do something like this:

OMPI_NUM_RANKS=1 run.sh &
OMPI_NUM_RANKS=2 run.sh &
...
OMPI_NUM_RANKS=10 run.sh &
Alexander Pozdneev
  • 1,289
  • 1
  • 13
  • 31
  • 1
    I doubt it's possible. Just write a small wrapper `mpirun`-script that calls the original `/path/to/mpirun` and trick `run.sh` to use that by setting `PATH` accordingly. – Zulan Oct 12 '17 at 14:20
  • Do you know how `run.sh` or `mpirun` known about the number of cores assigned by LSF (the `-n 20`)? Just a guess, its one of the environment variables `$LSB_HOSTS`, `$LSB_AFFINITY_HOSTFILE`. Maybe you can modify these between calls to `run.sh`. – Michael Closson Oct 13 '17 at 00:31
  • 1
    For LSF, Open MPI uses the LSF API to gather the info you need, so i think the `mpirun` wrapper is the best candidate. if you choose to bind MPI tasks, double check two MPI tasks from two different `mpirun` instances do not use the same cores. – Gilles Gouaillardet Oct 13 '17 at 00:55

0 Answers0