KaMPIng 0.1.1
Flexible and (near) zero-overhead C++ bindings for MPI
Loading...
Searching...
No Matches
kamping::plugin::ReproducibleReducePlugin< Comm, DefaultContainerType > Class Template Reference

Reproducible reduction of distributed arrays. More...

#include <reproducible_reduce.hpp>

Inheritance diagram for kamping::plugin::ReproducibleReducePlugin< Comm, DefaultContainerType >:
Collaboration diagram for kamping::plugin::ReproducibleReducePlugin< Comm, DefaultContainerType >:

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.
 

Detailed Description

template<typename Comm, template< typename... > typename DefaultContainerType>
class kamping::plugin::ReproducibleReducePlugin< Comm, DefaultContainerType >

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:

Reduction of 16 elements distributed over 4 PEs

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.

Member Function Documentation

◆ make_reproducible_comm()

template<typename Comm , template< typename... > typename DefaultContainerType>
template<typename T , typename... Args>
auto kamping::plugin::ReproducibleReducePlugin< Comm, DefaultContainerType >::make_reproducible_comm ( Args... args)
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.

Template Parameters
TType of the elements that are to be reduced.
Parameters
argsAll required arguments as specified above.
Returns
A reproducible_reduce::ReproducibleCommunicator

The documentation for this class was generated from the following file: