Ginkgo: gko::experimental::mpi::communicator Class Reference

| Ginkgo Generated from branch based on main. Ginkgo version 1.11.0 A numerical linear algebra library targeting many-core architectures

Loading...
Searching...
No Matches
gko::experimental::mpi::communicator Class Reference

A thin wrapper of MPI_Comm that supports most MPI calls. More...

`#include <ginkgo/core/base/mpi.hpp>`

## Public Member Functions
| communicator (const MPI_Comm &comm, bool force_host_buffer=false)
| Non-owning constructor for an existing communicator of type MPI_Comm.
| communicator (const MPI_Comm &comm, int color, int key)
| Create a communicator object from an existing MPI_Comm object using color and key.
| communicator (const communicator &comm, int color, int key)
| Create a communicator object from an existing MPI_Comm object using color and key.
| communicator (const communicator &other)=default
| Create a copy of a communicator.
| communicator (communicator &&other)
| Move constructor.
communicator & | operator= (const communicator &other)=default
communicator & | operator= (communicator &&other)
const MPI_Comm & | get () const
| Return the underlying MPI_Comm object.
bool | force_host_buffer () const
int | size () const
| Return the size of the communicator (number of ranks).
int | rank () const
| Return the rank of the calling process in the communicator.
int | node_local_rank () const
| Return the node local rank of the calling process in the communicator.
bool | operator== (const communicator &rhs) const
| Compare two communicator objects for equality.
bool | operator!= (const communicator &rhs) const
| Compare two communicator objects for non-equality.
bool | is_identical (const communicator &rhs) const
| Checks if the rhs communicator is identical to this communicator.
bool | is_congruent (const communicator &rhs) const
| Checks if the rhs communicator is congruent to this communicator.
void | synchronize () const
| This function is used to synchronize the ranks in the communicator.
template<typename SendType>
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.
template<typename SendType>
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.
template<typename RecvType>
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.
template<typename RecvType>
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.
template<typename BroadcastType>
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.
template<typename BroadcastType>
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
template<typename ReduceType>
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.
template<typename ReduceType>
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.
template<typename ReduceType>
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.
template<typename ReduceType>
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.
template<typename ReduceType>
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.
template<typename ReduceType>
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.
template<typename SendType, typename RecvType>
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.
template<typename SendType, typename RecvType>
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.
template<typename SendType, typename RecvType>
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.
template<typename SendType, typename RecvType>
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.
template<typename SendType, typename RecvType>
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.
template<typename SendType, typename RecvType>
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.
template<typename SendType, typename RecvType>
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.
template<typename SendType, typename RecvType>
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.
template<typename SendType, typename RecvType>
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.
template<typename SendType, typename RecvType>
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.
template<typename RecvType>
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).
template<typename RecvType>
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).
template<typename SendType, typename RecvType>
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).
template<typename SendType, typename RecvType>
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).
template<typename SendType, typename RecvType>
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).
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).
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).
template<typename SendType, typename RecvType>
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).
template<typename ScanType>
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.
template<typename ScanType>
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.

## Static Public Member Functions
static communicator | create_owning (const MPI_Comm &comm, bool force_host_buffer=false)
| Creates a new communicator and takes ownership of the MPI_Comm.

## Detailed Description

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.

## Constructor & Destructor Documentation

## ◆ communicator() [1/5]

gko::experimental::mpi::communicator::communicator | ( | const MPI_Comm & | comm,
|  | bool | force_host_buffer = false )
| inline

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

Referenced by communicator(), communicator(), communicator(), create_owning(), is_congruent(), is_identical(), operator!=(), operator=(), operator=(), and operator==().

## ◆ communicator() [2/5]

gko::experimental::mpi::communicator::communicator | ( | const MPI_Comm & | comm,
|  | int | color,
|  | int | key )
| inline

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

## ◆ communicator() [3/5]

gko::experimental::mpi::communicator::communicator | ( | const communicator & | comm,
|  | int | color,
|  | int | key )
| inline

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

References communicator(), and get().

## ◆ communicator() [4/5]

gko::experimental::mpi::communicator::communicator | ( | const communicator & | other | ) |
| default

Create a copy of a communicator.

Potential ownership of the underlying MPI_Comm will be shared.

References communicator().

## ◆ communicator() [5/5]

gko::experimental::mpi::communicator::communicator | ( | communicator && | other | ) |
| inline

Move constructor.

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

References communicator().

## Member Function Documentation

## ◆ all_gather()

template<typename SendType, typename RecvType>

void gko::experimental::mpi::communicator::all_gather | ( | std::shared_ptr< const Executor > | exec,
|  | const SendType * | send_buffer,
|  | const int | send_count,
|  | RecvType * | recv_buffer,
|  | const int | recv_count ) const
| inline

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.

References get().

## ◆ all_reduce() [1/2]

template<typename ReduceType>

void gko::experimental::mpi::communicator::all_reduce | ( | std::shared_ptr< const Executor > | exec,
|  | const ReduceType * | send_buffer,
|  | ReduceType * | recv_buffer,
|  | int | count,
|  | MPI_Op | operation ) const
| inline

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.

References get().

## ◆ all_reduce() [2/2]

template<typename ReduceType>

void gko::experimental::mpi::communicator::all_reduce | ( | std::shared_ptr< const Executor > | exec,
|  | ReduceType * | recv_buffer,
|  | int | count,
|  | MPI_Op | operation ) const
| inline

(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.

References get().

## ◆ all_to_all() [1/2]

template<typename SendType, typename RecvType>

void gko::experimental::mpi::communicator::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
| inline

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.

References get().

## ◆ all_to_all() [2/2]

template<typename RecvType>

void gko::experimental::mpi::communicator::all_to_all | ( | std::shared_ptr< const Executor > | exec,
|  | RecvType * | recv_buffer,
|  | const int | recv_count ) const
| inline

(In-place) Communicate data from all ranks to all other ranks in place (MPI_Alltoall).

See MPI documentation for more details.

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.

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

References get().

## ◆ all_to_all_v() [1/2]

template<typename SendType, typename RecvType>

void gko::experimental::mpi::communicator::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
| inline

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.

References all_to_all_v().

Referenced by all_to_all_v().

## ◆ all_to_all_v() [2/2]

void gko::experimental::mpi::communicator::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
| inline

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

References get().

## ◆ broadcast()

template<typename BroadcastType>

void gko::experimental::mpi::communicator::broadcast | ( | std::shared_ptr< const Executor > | exec,
|  | BroadcastType * | buffer,
|  | int | count,
|  | int | root_rank ) const
| inline

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.

References get().

## ◆ create_owning()

communicator gko::experimental::mpi::communicator::create_owning | ( | const MPI_Comm & | comm,
|  | bool | force_host_buffer = false )
| inlinestatic

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.

See also
  communicator(const MPI_Comm&, bool)

References communicator().

## ◆ gather()

template<typename SendType, typename RecvType>

void gko::experimental::mpi::communicator::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
| inline

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.

References get().

## ◆ gather_v()

template<typename SendType, typename RecvType>

void gko::experimental::mpi::communicator::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
| inline

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.

References get().

## ◆ get()

const MPI_Comm & gko::experimental::mpi::communicator::get | ( |  | ) | const
| inline

Return the underlying MPI_Comm object.

Returns
  the MPI_Comm object

Referenced by all_gather(), all_reduce(), all_reduce(), all_to_all(), all_to_all(), all_to_all_v(), broadcast(), communicator(), gather(), gather_v(), i_all_gather(), i_all_reduce(), i_all_reduce(), i_all_to_all(), i_all_to_all(), i_all_to_all_v(), i_broadcast(), i_gather(), i_gather_v(), i_recv(), i_reduce(), i_scan(), i_scatter(), i_scatter_v(), i_send(), is_congruent(), is_identical(), recv(), reduce(), scan(), scatter(), scatter_v(), send(), synchronize(), and gko::experimental::mpi::window< ValueType >::window().

## ◆ i_all_gather()

template<typename SendType, typename RecvType>

request gko::experimental::mpi::communicator::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
| inline

(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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_all_reduce() [1/2]

template<typename ReduceType>

request gko::experimental::mpi::communicator::i_all_reduce | ( | std::shared_ptr< const Executor > | exec,
|  | const ReduceType * | send_buffer,
|  | ReduceType * | recv_buffer,
|  | int | count,
|  | MPI_Op | operation ) const
| inline

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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_all_reduce() [2/2]

template<typename ReduceType>

request gko::experimental::mpi::communicator::i_all_reduce | ( | std::shared_ptr< const Executor > | exec,
|  | ReduceType * | recv_buffer,
|  | int | count,
|  | MPI_Op | operation ) const
| inline

(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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_all_to_all() [1/2]

template<typename SendType, typename RecvType>

request gko::experimental::mpi::communicator::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
| inline

(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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_all_to_all() [2/2]

template<typename RecvType>

request gko::experimental::mpi::communicator::i_all_to_all | ( | std::shared_ptr< const Executor > | exec,
|  | RecvType * | recv_buffer,
|  | const int | recv_count ) const
| inline

(In-place, Non-blocking) Communicate data from all ranks to all other ranks in place (MPI_Ialltoall).

See MPI documentation for more details.

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

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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_all_to_all_v() [1/2]

template<typename SendType, typename RecvType>

request gko::experimental::mpi::communicator::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
| inline

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

References i_all_to_all_v().

## ◆ i_all_to_all_v() [2/2]

request gko::experimental::mpi::communicator::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
| inline

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
  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

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

References get(), and gko::experimental::mpi::request::get().

Referenced by i_all_to_all_v().

## ◆ i_broadcast()

template<typename BroadcastType>

request gko::experimental::mpi::communicator::i_broadcast | ( | std::shared_ptr< const Executor > | exec,
|  | BroadcastType * | buffer,
|  | int | count,
|  | int | root_rank ) const
| inline

(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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_gather()

template<typename SendType, typename RecvType>

request gko::experimental::mpi::communicator::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
| inline

(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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_gather_v()

template<typename SendType, typename RecvType>

request gko::experimental::mpi::communicator::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
| inline

(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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_recv()

template<typename RecvType>

request gko::experimental::mpi::communicator::i_recv | ( | std::shared_ptr< const Executor > | exec,
|  | RecvType * | recv_buffer,
|  | const int | recv_count,
|  | const int | source_rank,
|  | const int | recv_tag ) const
| inline

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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_reduce()

template<typename ReduceType>

request gko::experimental::mpi::communicator::i_reduce | ( | std::shared_ptr< const Executor > | exec,
|  | const ReduceType * | send_buffer,
|  | ReduceType * | recv_buffer,
|  | int | count,
|  | MPI_Op | operation,
|  | int | root_rank ) const
| inline

(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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_scan()

template<typename ScanType>

request gko::experimental::mpi::communicator::i_scan | ( | std::shared_ptr< const Executor > | exec,
|  | const ScanType * | send_buffer,
|  | ScanType * | recv_buffer,
|  | int | count,
|  | MPI_Op | operation ) const
| inline

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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_scatter()

template<typename SendType, typename RecvType>

request gko::experimental::mpi::communicator::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
| inline

(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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_scatter_v()

template<typename SendType, typename RecvType>

request gko::experimental::mpi::communicator::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
| inline

(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

References get(), and gko::experimental::mpi::request::get().

## ◆ i_send()

template<typename SendType>

request gko::experimental::mpi::communicator::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
| inline

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

References get(), and gko::experimental::mpi::request::get().

## ◆ is_congruent()

bool gko::experimental::mpi::communicator::is_congruent | ( | const communicator & | rhs | ) | const
| inline

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

References communicator(), and get().

## ◆ is_identical()

bool gko::experimental::mpi::communicator::is_identical | ( | const communicator & | rhs | ) | const
| inline

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

References communicator(), and get().

Referenced by operator==().

## ◆ node_local_rank()

int gko::experimental::mpi::communicator::node_local_rank | ( |  | ) | const
| inline

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

Returns
  the node local rank

## ◆ operator!=()

bool gko::experimental::mpi::communicator::operator!= | ( | const communicator & | rhs | ) | const
| inline

Compare two communicator objects for non-equality.

Returns
  if the two comm objects are not equal

References communicator().

## ◆ operator=() [1/2]

communicator & gko::experimental::mpi::communicator::operator= | ( | communicator && | other | ) |
| inline

See also
  communicator(communicator&&)

References communicator().

## ◆ operator=() [2/2]

communicator & gko::experimental::mpi::communicator::operator= | ( | const communicator & | other | ) |
| default

See also
  communicator(const communicator&)

References communicator().

## ◆ operator==()

bool gko::experimental::mpi::communicator::operator== | ( | const communicator & | rhs | ) | const
| inline

Compare two communicator objects for equality.

Returns
  if the two comm objects are equal

References communicator(), and is_identical().

## ◆ rank()

int gko::experimental::mpi::communicator::rank | ( |  | ) | const
| inline

Return the rank of the calling process in the communicator.

Returns
  the rank

## ◆ recv()

template<typename RecvType>

status gko::experimental::mpi::communicator::recv | ( | std::shared_ptr< const Executor > | exec,
|  | RecvType * | recv_buffer,
|  | const int | recv_count,
|  | const int | source_rank,
|  | const int | recv_tag ) const
| inline

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

References get(), and gko::experimental::mpi::status::get().

## ◆ reduce()

template<typename ReduceType>

void gko::experimental::mpi::communicator::reduce | ( | std::shared_ptr< const Executor > | exec,
|  | const ReduceType * | send_buffer,
|  | ReduceType * | recv_buffer,
|  | int | count,
|  | MPI_Op | operation,
|  | int | root_rank ) const
| inline

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.

References get().

## ◆ scan()

template<typename ScanType>

void gko::experimental::mpi::communicator::scan | ( | std::shared_ptr< const Executor > | exec,
|  | const ScanType * | send_buffer,
|  | ScanType * | recv_buffer,
|  | int | count,
|  | MPI_Op | operation ) const
| inline

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.

References get().

## ◆ scatter()

template<typename SendType, typename RecvType>

void gko::experimental::mpi::communicator::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
| inline

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.

References get().

## ◆ scatter_v()

template<typename SendType, typename RecvType>

void gko::experimental::mpi::communicator::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
| inline

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.

References get().

## ◆ send()

template<typename SendType>

void gko::experimental::mpi::communicator::send | ( | std::shared_ptr< const Executor > | exec,
|  | const SendType * | send_buffer,
|  | const int | send_count,
|  | const int | destination_rank,
|  | const int | send_tag ) const
| inline

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.

References get().

## ◆ size()

int gko::experimental::mpi::communicator::size | ( |  | ) | const
| inline

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

Returns
  the size

## ◆ synchronize()

void gko::experimental::mpi::communicator::synchronize | ( |  | ) | const
| inline

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

Calls MPI_Barrier

References get().

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

- ginkgo/core/base/mpi.hpp