Ginkgo  Generated from pipelines/2897303314 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
Public Types | Public Member Functions | List of all members
gko::experimental::mpi::CollectiveCommunicator Class Referenceabstract

Interface for a collective communicator. More...

#include <ginkgo/core/distributed/collective_communicator.hpp>

Inheritance diagram for gko::experimental::mpi::CollectiveCommunicator:
[legend]

Public Types

using index_map_ptr = std::variant< const distributed::index_map< int32, int32 > *, const distributed::index_map< int32, int64 > *, const distributed::index_map< int64, int64 > * >
 All allowed index_map types (as const *)
 

Public Member Functions

 CollectiveCommunicator (communicator base=MPI_COMM_NULL)
 
const communicator & get_base_communicator () const
 
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. More...
 
request i_all_to_all_v (std::shared_ptr< const Executor > exec, const void *send_buffer, MPI_Datatype send_type, void *recv_buffer, MPI_Datatype recv_type) const
 
virtual std::unique_ptr< CollectiveCommunicator > create_with_same_type (communicator base, index_map_ptr imap) const =0
 Creates a new CollectiveCommunicator with the same dynamic type. More...
 
virtual std::unique_ptr< CollectiveCommunicator > create_inverse () const =0
 Creates a CollectiveCommunicator with the inverse communication pattern than this object. More...
 
virtual std::pair< std::unique_ptr< CollectiveCommunicator >, std::vector< comm_index_type > > resize (std::shared_ptr< const Executor > exec, const std::vector< comm_index_type > &send_factors) const =0
 Create new communicator that sends and receives a different number of elements to/from each rank in its current pattern. More...
 
virtual comm_index_type get_recv_size () const =0
 Get the number of elements received by this process within this communication pattern. More...
 
virtual comm_index_type get_send_size () const =0
 Get the number of elements sent by this process within this communication pattern. More...
 

Detailed Description

Interface for a collective communicator.

A collective communicator only provides routines for collective communications. At the moment this is restricted to the variable all-to-all.

Member Function Documentation

◆ create_inverse()

virtual std::unique_ptr<CollectiveCommunicator> gko::experimental::mpi::CollectiveCommunicator::create_inverse ( ) const
pure virtual

Creates a CollectiveCommunicator with the inverse communication pattern than this object.

Returns
a CollectiveCommunicator with the inverse communication pattern.

Implemented in gko::experimental::mpi::DenseCommunicator, and gko::experimental::mpi::NeighborhoodCommunicator.

◆ create_with_same_type()

virtual std::unique_ptr<CollectiveCommunicator> gko::experimental::mpi::CollectiveCommunicator::create_with_same_type ( communicator  base,
index_map_ptr  imap 
) const
pure virtual

Creates a new CollectiveCommunicator with the same dynamic type.

Parameters
baseThe base communicator
imapThe index_map that defines the communication pattern
Returns
a CollectiveCommunicator with the same dynamic type

Implemented in gko::experimental::mpi::NeighborhoodCommunicator, and gko::experimental::mpi::DenseCommunicator.

◆ get_recv_size()

virtual comm_index_type gko::experimental::mpi::CollectiveCommunicator::get_recv_size ( ) const
pure virtual

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

Returns
number of received elements.

Implemented in gko::experimental::mpi::NeighborhoodCommunicator, and gko::experimental::mpi::DenseCommunicator.

◆ get_send_size()

virtual comm_index_type gko::experimental::mpi::CollectiveCommunicator::get_send_size ( ) const
pure virtual

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

Returns
number of sent elements.

Implemented in gko::experimental::mpi::NeighborhoodCommunicator, and gko::experimental::mpi::DenseCommunicator.

◆ i_all_to_all_v() [1/2]

template<typename SendType , typename RecvType >
request gko::experimental::mpi::CollectiveCommunicator::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
SendTypethe type of the elements to send
RecvTypethe type of the elements to receive
Parameters
execthe executor for the communication
send_bufferthe send buffer
recv_bufferthe receive buffer
Returns
a request handle

◆ i_all_to_all_v() [2/2]

request gko::experimental::mpi::CollectiveCommunicator::i_all_to_all_v ( std::shared_ptr< const Executor >  exec,
const void *  send_buffer,
MPI_Datatype  send_type,
void *  recv_buffer,
MPI_Datatype  recv_type 
) const

◆ resize()

virtual std::pair<std::unique_ptr<CollectiveCommunicator>, std::vector<comm_index_type> > gko::experimental::mpi::CollectiveCommunicator::resize ( std::shared_ptr< const Executor >  exec,
const std::vector< comm_index_type > &  send_factors 
) const
pure virtual

Create new communicator that sends and receives a different number of elements to/from each rank in its current pattern.

The number of elements to send is deduces from the send_factors. If this communicator is used to send 2 elements to rank 0, and 3 elements to rank 1, then send_factors needs to have size 5, which is equal to get_send_size(). An send_factors = { 4, 2, 1, 3, 2} means that instead of the first element to send to rank 0, four elements are sent, instead of the second element to send to rank 0, two elements are sent, and so on. A visual representation of the transformation is:

[ 1 1 | 1 1 1 ] -> [ 4 2 | 1 3 2] -> [ 1 1 1 1 1 1 | 1 1 1 1 1 1 ]

The communication pattern will not change. Even if send_factors is zero for all elements of one rank, the rank will stay in the new pattern.

Note
This is a collective call.
Parameters
execthe executor to use for the new communicator
send_factorsthe new number of elements to send.
Returns
The new communicator and the recv_factors implied by the send_factors

Implemented in gko::experimental::mpi::NeighborhoodCommunicator, and gko::experimental::mpi::DenseCommunicator.


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