KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
|
Reproducible reduction of distributed arrays. More...
#include <reproducible_reduce.hpp>
Public Member Functions | |
template<typename T , typename... Args> | |
auto | make_reproducible_comm (Args... args) |
Create a communicator with a fixed distribution of a global array that can perform reductions in the same reduction order. | |
Reproducible reduction of distributed arrays.
To make a reduction operation reproducible independent of communicator size and operation associativity, the computation order must be fixed. We assign a global index to each element and let a binary tree dictate the computation as seen in the figure below:
The ordering of array elements must not necessarily follow the rank order of PEs. We represent the distribution of array elements as a list of send_counts and displacements for each rank. For the example above, send_counts would be {4, 4, 4, 4}
since each rank keeps four elements, and the displacement would be {8, 4, 0, 12}
, since the first element of rank 0 has index 8, the first element of rank 1 has index 4 and so on.
More background of reproducible reduction is provided here.
|
inline |
Create a communicator with a fixed distribution of a global array that can perform reductions in the same reduction order.
The following parameters are required:
For further details, see documentation of the ReproducibleReducePlugin
Note that the reduce operation sends messages with the tag 0xb586772
. During the reduce, no messages shall be sent on the underlying communicator with this tag to avoid interference and potential deadlocks.
T | Type of the elements that are to be reduced. |
args | All required arguments as specified above. |