0

I am trying to run multiple instances of an mpi executable with one call to mpirun. I am using the following line to start my program from different directories so that it starts with different parameters.

mpirun -np 8 -wdir ./S1 $WDIR/S1/$EXE :\
    -np 8 -wdir ./S2 $WDIR/S2/$EXE :\
    -np 8 -wdir ./S3 $WDIR/S3/$EXE :\
    -np 8 -wdir ./S4 $WDIR/S4/$EXE

The executable follows a master-slave scheme and expects to have a rank 0 node to act as master.

Is it possible to call mpirun so that internally every instance of my executable see its processor ranks running from 0 to 7?

lev.tuby
  • 477
  • 3
  • 10
  • I don't understand what you are trying to do. If these 4 executables are independent MPI programs which do not communicate with each other then you could just run them all separately with their own mpirun. If, however, you want to have communication between processes in different executables then almost by definition they will need to have unique ranks from 0 - 31. Otherwise, if you send a message to rank 0, how can MPI know which rank 0 you mean? – David Henty Apr 22 '16 at 11:09
  • In a single MPI program, ranks in COMM_WORLD are always numbered from 0 to size-1. You could create four subcommunicators here, one for each executable, and within these subcomminicators the processes will be numbered 0-7. However, I don't see what this achieves beyond running 4 individual MPI programs. – David Henty Apr 22 '16 at 11:12
  • Thank for the comment! I was trying to go around some some problems with process pinning on a cluster and thought this may have been a way. I will try something else. – lev.tuby Apr 22 '16 at 11:32
  • 2
    I've marked your question as a duplicate of [that one](http://stackoverflow.com/questions/35924226/openmpi-mpmd-get-communication-size). Although the latter is about Open MPI and obtaining the size of each application context, Gilles' solution is generic and should work in your case too, as long as `argv[0]` of each rank is set to the value of `$WDIR/S.../$EXE`. – Hristo Iliev Apr 22 '16 at 12:01

0 Answers0