gko::experimental::mpi::communicator#

Owning C++ wrapper around MPI_Comm. Every distributed Ginkgo type (distributed::Matrix, distributed::Vector, distributed::Partition consumers, …) carries one of these. The class is reference-counted, so passing it by value is cheap and the underlying MPI_Comm is freed when the last communicator instance goes out of scope.

Most application code constructs a communicator once around MPI_COMM_WORLD (or a derived communicator) and threads it through the distributed types it creates.

gko::experimental::mpi::communicator comm{MPI_COMM_WORLD};
auto mat = gko::experimental::distributed::Matrix<...>::create(exec, comm);

The rank() and size() accessors return the current rank and total process count without going through MPI_Comm_rank / MPI_Comm_size on every call.

class communicator#

A thin wrapper of MPI_Comm that supports most MPI calls.

A wrapper class that takes in the given MPI communicator. If a bare MPI_Comm is provided, the wrapper takes no ownership of the MPI_Comm. Thus the MPI_Comm must remain valid throughout the lifetime of the communicator. If the communicator was created through splitting, the wrapper takes ownership of the MPI_Comm. In this case, as the class or object goes out of scope, the underlying MPI_Comm is freed.

Note

All MPI calls that work on a buffer take in an Executor as an additional argument. This argument specifies the memory space the buffer lives in.

Public Functions

inline communicator(
const MPI_Comm &comm,
bool force_host_buffer = false,
)#

Non-owning constructor for an existing communicator of type MPI_Comm. The MPI_Comm object will not be deleted after the communicator object has been freed and an explicit MPI_Comm_free needs to be called on the original MPI_Comm object.

Parameters:
  • comm – The input MPI_Comm object.

  • force_host_buffer – If set to true, always communicates through host memory

inline communicator(const MPI_Comm &comm, int color, int key)#

Create a communicator object from an existing MPI_Comm object using color and key.

Parameters:
  • comm – The input MPI_Comm object.

  • color – The color to split the original comm object

  • key – The key to split the comm object

inline communicator(const communicator &comm, int color, int key)#

Create a communicator object from an existing MPI_Comm object using color and key.

Parameters:
  • comm – The input communicator object.

  • color – The color to split the original comm object

  • key – The key to split the comm object

communicator(const communicator &other) = default#

Create a copy of a communicator.

Potential ownership of the underlying MPI_Comm will be shared.

inline communicator(communicator &&other)#

Move constructor.

The other communicator will relinquish any potential ownership and use MPI_COMM_NULL as underlying MPI_Comm after the move operation.

communicator &operator=(const communicator &other) = default#

inline communicator &operator=(communicator &&other)#

inline const MPI_Comm &get() const#

Return the underlying MPI_Comm object.

Returns:

the MPI_Comm object

inline int size() const#

Return the size of the communicator (number of ranks).

Returns:

the size

inline int rank() const#

Return the rank of the calling process in the communicator.

Returns:

the rank

inline int node_local_rank() const#

Return the node local rank of the calling process in the communicator.

Returns:

the node local rank

inline bool operator==(const communicator &rhs) const#

Compare two communicator objects for equality.

Returns:

if the two comm objects are equal

inline bool operator!=(const communicator &rhs) const#

Compare two communicator objects for non-equality.

Returns:

if the two comm objects are not equal

inline bool is_identical(const communicator &rhs) const#

Checks if the rhs communicator is identical to this communicator.

Note

If MPI_COMM_NULL is the underlying MPI_COMM of this, then the communicator is equal to rhs, iff MPI_COMM_NULL is also the underlying MPI_COMM of rhs.

Returns:

true if rhs is identical to this

inline bool is_congruent(const communicator &rhs) const#

Checks if the rhs communicator is congruent to this communicator.

Congruent communicators are defined as having identical rank members and rank ordering.

Note

If MPI_COMM_NULL is the underlying MPI_COMM of this, then the communicator is congruent to rhs, iff MPI_COMM_NULL is also the underlying MPI_COMM of rhs.

Returns:

true if rhs is congruent to this

inline void synchronize() const#

This function is used to synchronize the ranks in the communicator. Calls MPI_Barrier

template<typename SendType>
inline void send(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
const int destination_rank,
const int send_tag,
) const#

Send (Blocking) data from calling process to destination rank.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • send_buffer – the buffer to send

  • send_count – the number of elements to send

  • destination_rank – the rank to send the data to

  • send_tag – the tag for the send call

Template Parameters:

SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

template<typename SendType>
inline request i_send(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
const int destination_rank,
const int send_tag,
) const#

Send (Non-blocking, Immediate return) data from calling process to destination rank.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • send_buffer – the buffer to send

  • send_count – the number of elements to send

  • destination_rank – the rank to send the data to

  • send_tag – the tag for the send call

Template Parameters:

SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

Returns:

the request handle for the send call

template<typename RecvType>
inline status recv(
std::shared_ptr<const Executor> exec,
RecvType *recv_buffer,
const int recv_count,
const int source_rank,
const int recv_tag,
) const#

Receive data from source rank.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • recv_buffer – the buffer to receive

  • recv_count – the number of elements to receive

  • source_rank – the rank to receive the data from

  • recv_tag – the tag for the recv call

Template Parameters:

RecvType – the type of the data to receive. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

Returns:

the status of completion of this call

template<typename RecvType>
inline request i_recv(
std::shared_ptr<const Executor> exec,
RecvType *recv_buffer,
const int recv_count,
const int source_rank,
const int recv_tag,
) const#

Receive (Non-blocking, Immediate return) data from source rank.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • recv_buffer – the buffer to send

  • recv_count – the number of elements to receive

  • source_rank – the rank to receive the data from

  • recv_tag – the tag for the recv call

Template Parameters:

RecvType – the type of the data to receive. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

Returns:

the request handle for the recv call

template<typename BroadcastType>
inline void broadcast(
std::shared_ptr<const Executor> exec,
BroadcastType *buffer,
int count,
int root_rank,
) const#

Broadcast data from calling process to all ranks in the communicator

Parameters:
  • exec – The executor, on which the message buffer is located.

  • buffer – the buffer to broadcast

  • count – the number of elements to broadcast

  • root_rank – the rank to broadcast from

Template Parameters:

BroadcastType – the type of the data to broadcast. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

template<typename BroadcastType>
inline request i_broadcast(
std::shared_ptr<const Executor> exec,
BroadcastType *buffer,
int count,
int root_rank,
) const#

(Non-blocking) Broadcast data from calling process to all ranks in the communicator

Parameters:
  • exec – The executor, on which the message buffer is located.

  • buffer – the buffer to broadcast

  • count – the number of elements to broadcast

  • root_rank – the rank to broadcast from

Template Parameters:

BroadcastType – the type of the data to broadcast. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

Returns:

the request handle for the call

template<typename ReduceType>
inline void reduce(
std::shared_ptr<const Executor> exec,
const ReduceType *send_buffer,
ReduceType *recv_buffer,
int count,
MPI_Op operation,
int root_rank,
) const#

Reduce data into root from all calling processes on the same communicator.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • send_buffer – the buffer to reduce

  • recv_buffer – the reduced result

  • count – the number of elements to reduce

  • operation – the MPI_Op type reduce operation.

Template Parameters:

ReduceType – the type of the data to reduce. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

template<typename ReduceType>
inline request i_reduce(
std::shared_ptr<const Executor> exec,
const ReduceType *send_buffer,
ReduceType *recv_buffer,
int count,
MPI_Op operation,
int root_rank,
) const#

(Non-blocking) Reduce data into root from all calling processes on the same communicator.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • send_buffer – the buffer to reduce

  • recv_buffer – the reduced result

  • count – the number of elements to reduce

  • operation – the MPI_Op type reduce operation.

Template Parameters:

ReduceType – the type of the data to reduce. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

Returns:

the request handle for the call

template<typename ReduceType>
inline void all_reduce(
std::shared_ptr<const Executor> exec,
ReduceType *recv_buffer,
int count,
MPI_Op operation,
) const#

(In-place) Reduce data from all calling processes from all calling processes on same communicator.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • recv_buffer – the data to reduce and the reduced result

  • count – the number of elements to reduce

  • operation – the MPI_Op type reduce operation.

Template Parameters:

ReduceType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

template<typename ReduceType>
inline request i_all_reduce(
std::shared_ptr<const Executor> exec,
ReduceType *recv_buffer,
int count,
MPI_Op operation,
) const#

(In-place, non-blocking) Reduce data from all calling processes from all calling processes on same communicator.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • recv_buffer – the data to reduce and the reduced result

  • count – the number of elements to reduce

  • operation – the reduce operation. See @MPI_Op

Template Parameters:

ReduceType – the type of the data to reduce. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

Returns:

the request handle for the call

template<typename ReduceType>
inline void all_reduce(
std::shared_ptr<const Executor> exec,
const ReduceType *send_buffer,
ReduceType *recv_buffer,
int count,
MPI_Op operation,
) const#

Reduce data from all calling processes from all calling processes on same communicator.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the data to reduce

  • recv_buffer – the reduced result

  • count – the number of elements to reduce

  • operation – the reduce operation. See @MPI_Op

Template Parameters:

ReduceType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

template<typename ReduceType>
inline request i_all_reduce(
std::shared_ptr<const Executor> exec,
const ReduceType *send_buffer,
ReduceType *recv_buffer,
int count,
MPI_Op operation,
) const#

Reduce data from all calling processes from all calling processes on same communicator.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the data to reduce

  • recv_buffer – the reduced result

  • count – the number of elements to reduce

  • operation – the reduce operation. See @MPI_Op

Template Parameters:

ReduceType – the type of the data to reduce. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

Returns:

the request handle for the call

template<typename SendType, typename RecvType>
inline void gather(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int recv_count,
int root_rank,
) const#

Gather data onto the root rank from all ranks in the communicator.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • root_rank – the rank to gather into

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

template<typename SendType, typename RecvType>
inline request i_gather(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int recv_count,
int root_rank,
) const#

(Non-blocking) Gather data onto the root rank from all ranks in the communicator.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • root_rank – the rank to gather into

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

Returns:

the request handle for the call

template<typename SendType, typename RecvType>
inline void gather_v(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int *recv_counts,
const int *displacements,
int root_rank,
) const#

Gather data onto the root rank from all ranks in the communicator with offsets.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • displacements – the offsets for the buffer

  • root_rank – the rank to gather into

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

template<typename SendType, typename RecvType>
inline request i_gather_v(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int *recv_counts,
const int *displacements,
int root_rank,
) const#

(Non-blocking) Gather data onto the root rank from all ranks in the communicator with offsets.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • displacements – the offsets for the buffer

  • root_rank – the rank to gather into

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

Returns:

the request handle for the call

template<typename SendType, typename RecvType>
inline void all_gather(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int recv_count,
) const#

Gather data onto all ranks from all ranks in the communicator.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

template<typename SendType, typename RecvType>
inline request i_all_gather(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int recv_count,
) const#

(Non-blocking) Gather data onto all ranks from all ranks in the communicator.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

Returns:

the request handle for the call

template<typename SendType, typename RecvType>
inline void scatter(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int recv_count,
int root_rank,
) const#

Scatter data from root rank to all ranks in the communicator.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

template<typename SendType, typename RecvType>
inline request i_scatter(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int recv_count,
int root_rank,
) const#

(Non-blocking) Scatter data from root rank to all ranks in the communicator.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

Returns:

the request handle for the call

template<typename SendType, typename RecvType>
inline void scatter_v(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int *send_counts,
const int *displacements,
RecvType *recv_buffer,
const int recv_count,
int root_rank,
) const#

Scatter data from root rank to all ranks in the communicator with offsets.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • displacements – the offsets for the buffer

  • comm – the communicator

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

template<typename SendType, typename RecvType>
inline request i_scatter_v(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int *send_counts,
const int *displacements,
RecvType *recv_buffer,
const int recv_count,
int root_rank,
) const#

(Non-blocking) Scatter data from root rank to all ranks in the communicator with offsets.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to gather from

  • send_count – the number of elements to send

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • displacements – the offsets for the buffer

  • comm – the communicator

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

Returns:

the request handle for the call

template<typename RecvType>
inline void all_to_all(
std::shared_ptr<const Executor> exec,
RecvType *recv_buffer,
const int recv_count,
) const#

(In-place) Communicate data from all ranks to all other ranks in place (MPI_Alltoall). See MPI documentation for more details.

Note

This overload uses MPI_IN_PLACE and the source and destination buffers are the same.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • buffer – the buffer to send and the buffer receive

  • recv_count – the number of elements to receive

  • comm – the communicator

Template Parameters:

RecvType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

template<typename RecvType>
inline request i_all_to_all(
std::shared_ptr<const Executor> exec,
RecvType *recv_buffer,
const int recv_count,
) const#

(In-place, Non-blocking) Communicate data from all ranks to all other ranks in place (MPI_Ialltoall). See MPI documentation for more details.

Note

This overload uses MPI_IN_PLACE and the source and destination buffers are the same.

Parameters:
  • exec – The executor, on which the message buffer is located.

  • buffer – the buffer to send and the buffer receive

  • recv_count – the number of elements to receive

  • comm – the communicator

Template Parameters:

RecvType – the type of the data to receive. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

Returns:

the request handle for the call

template<typename SendType, typename RecvType>
inline void all_to_all(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int recv_count,
) const#

Communicate data from all ranks to all other ranks (MPI_Alltoall). See MPI documentation for more details.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to send

  • send_count – the number of elements to send

  • recv_buffer – the buffer to receive

  • recv_count – the number of elements to receive

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

template<typename SendType, typename RecvType>
inline request i_all_to_all(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int send_count,
RecvType *recv_buffer,
const int recv_count,
) const#

(Non-blocking) Communicate data from all ranks to all other ranks (MPI_Ialltoall). See MPI documentation for more details.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to send

  • send_count – the number of elements to send

  • recv_buffer – the buffer to receive

  • recv_count – the number of elements to receive

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

Returns:

the request handle for the call

template<typename SendType, typename RecvType>
inline void all_to_all_v(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int *send_counts,
const int *send_offsets,
RecvType *recv_buffer,
const int *recv_counts,
const int *recv_offsets,
) const#

Communicate data from all ranks to all other ranks with offsets (MPI_Alltoallv). See MPI documentation for more details.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to send

  • send_count – the number of elements to send

  • send_offsets – the offsets for the send buffer

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • recv_offsets – the offsets for the recv buffer

  • comm – the communicator

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

inline void all_to_all_v(
std::shared_ptr<const Executor> exec,
const void *send_buffer,
const int *send_counts,
const int *send_offsets,
MPI_Datatype send_type,
void *recv_buffer,
const int *recv_counts,
const int *recv_offsets,
MPI_Datatype recv_type,
) const#

Communicate data from all ranks to all other ranks with offsets (MPI_Alltoallv). See MPI documentation for more details.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to send

  • send_count – the number of elements to send

  • send_offsets – the offsets for the send buffer

  • send_type – the MPI_Datatype for the send buffer

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • recv_offsets – the offsets for the recv buffer

  • recv_type – the MPI_Datatype for the recv buffer

  • comm – the communicator

inline request i_all_to_all_v(
std::shared_ptr<const Executor> exec,
const void *send_buffer,
const int *send_counts,
const int *send_offsets,
MPI_Datatype send_type,
void *recv_buffer,
const int *recv_counts,
const int *recv_offsets,
MPI_Datatype recv_type,
) const#

Communicate data from all ranks to all other ranks with offsets (MPI_Ialltoallv). See MPI documentation for more details.

Note

This overload allows specifying the MPI_Datatype for both the send and received data.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to send

  • send_count – the number of elements to send

  • send_offsets – the offsets for the send buffer

  • send_type – the MPI_Datatype for the send buffer

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • recv_offsets – the offsets for the recv buffer

  • recv_type – the MPI_Datatype for the recv buffer

Returns:

the request handle for the call

template<typename SendType, typename RecvType>
inline request i_all_to_all_v(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
const int *send_counts,
const int *send_offsets,
RecvType *recv_buffer,
const int *recv_counts,
const int *recv_offsets,
) const#

Communicate data from all ranks to all other ranks with offsets (MPI_Ialltoallv). See MPI documentation for more details.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to send

  • send_count – the number of elements to send

  • send_offsets – the offsets for the send buffer

  • recv_buffer – the buffer to gather into

  • recv_count – the number of elements to receive

  • recv_offsets – the offsets for the recv buffer

Template Parameters:
  • SendType – the type of the data to send. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

  • RecvType – the type of the data to receive. The same restrictions as for SendType apply.

Returns:

the request handle for the call

template<typename ScanType>
inline void scan(
std::shared_ptr<const Executor> exec,
const ScanType *send_buffer,
ScanType *recv_buffer,
int count,
MPI_Op operation,
) const#

Does a scan operation with the given operator. (MPI_Scan). See MPI documentation for more details.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to scan from

  • recv_buffer – the result buffer

  • recv_count – the number of elements to scan

  • operation – the operation type to be used for the scan. See @MPI_Op

Template Parameters:

ScanType – the type of the data to scan. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

template<typename ScanType>
inline request i_scan(
std::shared_ptr<const Executor> exec,
const ScanType *send_buffer,
ScanType *recv_buffer,
int count,
MPI_Op operation,
) const#

Does a scan operation with the given operator. (MPI_Iscan). See MPI documentation for more details.

Parameters:
  • exec – The executor, on which the message buffers are located.

  • send_buffer – the buffer to scan from

  • recv_buffer – the result buffer

  • recv_count – the number of elements to scan

  • operation – the operation type to be used for the scan. See @MPI_Op

Template Parameters:

ScanType – the type of the data to scan. Has to be a type which has a specialization of type_impl that defines its MPI_Datatype.

Returns:

the request handle for the call

Public Static Functions

static inline communicator create_owning(
const MPI_Comm &comm,
bool force_host_buffer = false,
)#

Creates a new communicator and takes ownership of the MPI_Comm.

The ownership is shared with all mpi::communicator objects that are a copy from the newly created communicator. The underlying MPI_Comm will be freed when the last communicator with ownership is destroyed.