Mapping of processes to ranks in Open MPI can be controlled with various CLI arguments to mpiexec
with newer versions (like 1.7.x) supporting much finer control than older versions. By default ranks follow the order in which processes are placed in the slots provided. Therefore -np 1 exe1 : -np 1 exe2
will always result in exe1
being rank 0
and exe2
being rank 1
in MPI_COMM_WORLD
. If you use -np 3 exe1 : -np 2 exe2
instead, you will get the following:
rank executable
------------------
0 exe1
1 exe1
2 exe1
3 exe2
4 exe2
It is also possible to start exe1
and exe2
as separate MPI jobs and make them connect to each other over an intercommunicator but that is considered an advanced MPI topic.