TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
mpi::lazy< mpi::tag::gather, A >

#include <nda/mpi/gather.hpp>

Detailed Description

template<nda::Array A>
struct mpi::lazy< mpi::tag::gather, A >

Specialization of the mpi::lazy class for nda::Array types and the mpi::tag::gather tag.

An object of this class is returned when gathering 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 be a concatenation of the input arrays along the first dimension (see nda::concatenate).

See nda::mpi_gather for an example.

Template Parameters
Anda::Array type to be gathered.

Definition at line 50 of file gather.hpp.

Public Types

using const_view_type = decltype(std::declval<const A>()())
 Const view type of the array/view stored in the lazy object.
 
using value_type = typename std::decay_t<A>::value_type
 Value type of the array/view.
 

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_view_type rhs
 View of the array/view to be gathered.
 
const int root {0}
 MPI root process.
 

Member Function Documentation

◆ invoke()

template<nda::Array A>
template<nda::Array T>
void mpi::lazy< mpi::tag::gather, A >::invoke ( T && target) const
inline

Execute the lazy MPI operation and write the result to a target array/view.

Template Parameters
Tnda::Array type of the target array/view.
Parameters
targetTarget array/view.

Definition at line 98 of file gather.hpp.

◆ shape()

template<nda::Array A>
auto mpi::lazy< mpi::tag::gather, A >::shape ( ) const
inlinenodiscard

Compute the shape of the target array.

It is assumed that the shape of the input array is the same for all MPI processes except for the first dimension. The target shape will then be the same as the input shape, except that the extent of its first dimension will be the sum of the extents of the input arrays along the first dimension.

Warning
This makes an MPI call.
Returns
Shape of the target array.

Definition at line 80 of file gather.hpp.


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