gko::experimental::mpi::
DenseCommunicator#

Default implementation of CollectiveCommunicator. Uses MPI_Ineighbor_alltoallv over the standard MPI communicator (no graph topology required), which makes it portable but means every rank participates in the exchange even if it has no data to send.

Pick DenseCommunicator when in doubt — it works on every communicator topology and performs well at small-to-moderate process counts. Switch to NeighborhoodCommunicator at large rank counts where each rank only communicates with a few neighbours.

class DenseCommunicator #

Inherits from

A CollectiveCommunicator that uses a dense communication.

The dense communicator uses the MPI_Alltoall function for its communication.

Public Functions

explicit DenseCommunicator(communicator base)#

Default constructor with empty communication pattern

Parameters:

base – the base communicator

template<typename LocalIndexType, typename GlobalIndexType>
DenseCommunicator(
communicator base,
const distributed::index_map<LocalIndexType, GlobalIndexType> &imap,
)#

Create a DenseCommunicator from an index map.

The receiving neighbors are defined by the remote indices and their owning ranks of the index map. The send neighbors are deduced from that through collective communication.

Template Parameters:
  • LocalIndexType – the local index type of the map

  • GlobalIndexType – the global index type of the map

Parameters:
  • base – the base communicator

  • imap – the index map that defines the communication pattern

virtual std::unique_ptr<CollectiveCommunicator> create_with_same_type(
communicator base,
index_map_ptr imap,
) const override#

Creates a new CollectiveCommunicator with the same dynamic type.

Parameters:
  • base – The base communicator

  • imap – The index_map that defines the communication pattern

Returns:

a CollectiveCommunicator with the same dynamic type

virtual std::unique_ptr<CollectiveCommunicator> create_inverse(
) const override#

Creates the inverse DenseCommunicator by switching sources and destinations.

Returns:

CollectiveCommunicator with the inverse communication pattern

virtual comm_index_type get_recv_size() const override#

Get the number of elements received by this process within this communication pattern.

Returns:

number of received elements.

virtual comm_index_type get_send_size() const override#

Get the number of elements sent by this process within this communication pattern.

Returns:

number of sent elements.

template<typename SendType, typename RecvType>
request i_all_to_all_v(
std::shared_ptr<const Executor> exec,
const SendType *send_buffer,
RecvType *recv_buffer,
) const#

Non-blocking all-to-all communication.

The send_buffer must have allocated at least get_send_size number of elements, and the recv_buffer must have allocated at least get_recv_size number of elements.

Template Parameters:
  • SendType – the type of the elements to send

  • RecvType – the type of the elements to receive

Parameters:
  • exec – the executor for the communication

  • send_buffer – the send buffer

  • recv_buffer – the receive buffer

Returns:

a request handle

Friends

friend bool operator==(
const DenseCommunicator &a,
const DenseCommunicator &b,
)#

Compares two communicators for equality.

Equality is defined as having identical or congruent communicators and their communication pattern is equal. No communication is done, i.e. there is no reduction over the local equality check results.

Returns:

true if both communicators are equal.

friend bool operator!=(
const DenseCommunicator &a,
const DenseCommunicator &b,
)#

Compares two communicators for inequality.

See also

operator==