TRIQS/nda 1.3.0
Multi-dimensional array library for C++
|
#include <nda/mpi/reduce.hpp>
Specialization of the mpi::lazy
class for nda::Array types and the mpi::tag::reduce
tag.
An object of this class is returned when reducing nda::Array objects across multiple MPI processes.
It models an nda::ArrayInitializer, that means it can be used to initialize and assign to nda::basic_array and nda::basic_array_view objects. The target array will have the same shape as the input arrays.
See nda::mpi_reduce for an example.
A | nda::Array type to be reduced. |
Definition at line 50 of file reduce.hpp.
Public Member Functions | |
template<nda::Array T> | |
void | invoke (T &&target) const |
Execute the lazy MPI operation and write the result to a target array/view. | |
auto | shape () const |
Compute the shape of the target array. | |
Public Attributes | |
const bool | all {false} |
Should all processes receive the result. | |
mpi::communicator | comm |
MPI communicator. | |
const MPI_Op | op {MPI_SUM} |
MPI reduction operation. | |
const_view_type | rhs |
View of the array/view to be reduced. | |
const int | root {0} |
MPI root process. | |
|
inline |
Execute the lazy MPI operation and write the result to a target array/view.
If the target array/view is the same as the input array/view, i.e. if their data pointers are the same, the reduction is performed in-place.
T | nda::Array type of the target array/view. |
target | Target array/view. |
Definition at line 89 of file reduce.hpp.
|
inlinenodiscard |
Compute the shape of the target array.
Definition at line 77 of file reduce.hpp.