This is a header-only library to simplify the implementation of dynamic scaling on MPI 2.0. You can add or remove MPI processes during runtime. The added processes can communicate to the running processes immediately.
- Scale Out: Add new MPI processes to the running processes. The scaled processes join in the same MPI Intra-communicator as the running processes so that they can communicate each other.
- Scale In: Remove MPI processes from the running processes.
M. Hanai and G. Theodoropoulos "Performance Evaluation of Dynamic Scaling on MPI" (arXiv 2020)
$ git clone git@github.com:masatoshihanai/MPIDynamicScaling.git
$ cd MPIDynamicScaling
$ mkdir build; cd build
$ cmake ..; make
$ mpirun -np 2 ./DynamicScalingExample 2 1 We provide the usage for (1) scaling out and (2) scaling in. See also the example code example/main_example.cpp.
There are two APIs for scaling out.
scaleOut(MPI_Comm oldComm, int numAddProcs, string childCmd, MPI_Comm& newComm, vector<string> hosts): This is used in the original program. The original program invokes new processes and waits for them to join the new intra-communicator.oldCommis the original intra-communicatornewAddProcsis # additional MPI processeschildCmdis the path to Children's program.newCommis the new intra-communicator including the additional processes. Their rank IDs are assigned incrementally.hostsspecifies additional hosts (optional). Each value is formatted as "host01" or "host01 slots=32" if you want to specify # slots.
initNewProcess(MPI_Comm& newComm): This is used for the new processes invoked viascaleOut(). The new processes join to the new intra-communicator.newComm: is the new intra-communicator.
There is one API for scaling in.
scaleIn(MPI_Comm& oldComm, bool isRemoving, MPI_Comm& newComm, bool& thisHostCanTerminate): The processes are removed after calling this function.oldCommis the original communicatorisRemovingthe process is removed if this value is true; otherwise the process keeps alive.newCommis the new communicator excluding the removal processes.thisHostCanTerminateis true if there are no MPI processes in this host (optional).
!!! Note !!! : The original MPI processes cannot be removed. Only ones added via scaleOut() can be removed.
The library is hear-only. You may simply copy and include dynamic_scaling.hpp to your MPI code.
Open MPI 2.1.1gcc/g++ 9.1.0
mhanai at acm.org