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::distributed::RowGatherer< LocalIndexType > Class Template Reference

The distributed::RowGatherer gathers the rows of distributed::Vector that are located on other processes. More...

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

Inheritance diagram for gko::experimental::distributed::RowGatherer< LocalIndexType >:
[legend]
Collaboration diagram for gko::experimental::distributed::RowGatherer< LocalIndexType >:
[legend]

Public Member Functions

mpi::request apply_async (ptr_param< const LinOp > b, ptr_param< LinOp > x) const
 Asynchronous version of LinOp::apply.
mpi::request apply_async (ptr_param< const LinOp > b, ptr_param< LinOp > x, array< char > &workspace) const
 Asynchronous version of LinOp::apply.
dim< 2 > get_size () const
 Returns the size of the row gatherer.
std::shared_ptr< const mpi::CollectiveCommunicatorget_collective_communicator () const
 Get the used collective communicator.
const LocalIndexType * get_const_send_idxs () const
 Read access to the (local) rows indices.
size_type get_num_send_idxs () const
 Returns the number of (local) row indices.
 RowGatherer (const RowGatherer &o)
 RowGatherer (RowGatherer &&o) noexcept
RowGatherer & operator= (const RowGatherer &o)
RowGatherer & operator= (RowGatherer &&o)
Public Member Functions inherited from gko::EnablePolymorphicAssignment< RowGatherer< int32 > >
void convert_to (result_type *result) const override
void move_to (result_type *result) override
Public Member Functions inherited from gko::experimental::distributed::DistributedBase
 DistributedBase (const DistributedBase &other)=default
 DistributedBase (DistributedBase &&other)=default
DistributedBase & operator= (const DistributedBase &)
 Copy assignment that doesn't change the used mpi::communicator.
DistributedBase & operator= (DistributedBase &&) noexcept
 Move assignment that doesn't change the used mpi::communicator.
mpi::communicator get_communicator () const
 Access the used mpi::communicator.

Static Public Member Functions

template<typename GlobalIndexType = int64>
static std::unique_ptr< RowGatherer > create (std::shared_ptr< const Executor > exec, std::shared_ptr< const mpi::CollectiveCommunicator > coll_comm, const index_map< LocalIndexType, GlobalIndexType > &imap)
 Creates a distributed::RowGatherer from a given collective communicator and index map.
static std::unique_ptr< RowGatherer > create (std::shared_ptr< const Executor > exec, mpi::communicator comm)
static std::unique_ptr< RowGatherer > create (std::shared_ptr< const Executor > exec, std::shared_ptr< const mpi::CollectiveCommunicator > coll_comm_template)

Friends

class EnablePolymorphicObject< RowGatherer, PolymorphicObject >
template<typename ValueT, typename LocalIndexT, typename GlobalIndexT>
class Matrix

Additional Inherited Members

Public Types inherited from gko::EnablePolymorphicAssignment< RowGatherer< int32 > >
using result_type

Detailed Description

template<typename LocalIndexType = int32>
class gko::experimental::distributed::RowGatherer< LocalIndexType >

The distributed::RowGatherer gathers the rows of distributed::Vector that are located on other processes.

Example usage:

auto coll_comm = std::make_shared<mpi::neighborhood_communicator>(comm,
imap);
auto rg = distributed::RowGatherer<int32>::create(exec, coll_comm, imap);
auto req = rg->apply_async(b, x);
// users can do some computation that doesn't modify b, or access x
req.wait();
// x now contains the gathered rows of b
static std::unique_ptr< RowGatherer > create(std::shared_ptr< const Executor > exec, std::shared_ptr< const mpi::CollectiveCommunicator > coll_comm, const index_map< LocalIndexType, GlobalIndexType > &imap)
Creates a distributed::RowGatherer from a given collective communicator and index map.
Definition row_gatherer.hpp:198
static std::unique_ptr< Vector > create(std::shared_ptr< const Executor > exec, mpi::communicator comm, dim< 2 > global_size, dim< 2 > local_size, size_type stride)
Creates an empty distributed vector with a specified size.
static std::unique_ptr< Dense > create(std::shared_ptr< const Executor > exec, const dim< 2 > &size={}, size_type stride=0)
Creates an uninitialized Dense matrix of the specified size.
Note
The output vector for the apply_async functions must use an executor that is compatible with the MPI implementation. In particular, if the MPI implementation is not GPU aware, then the output vector must use a CPU executor. Otherwise, an exception will be thrown.
Template Parameters
LocalIndexTypethe index type for the stored indices

Member Function Documentation

◆ apply_async() [1/2]

template<typename LocalIndexType = int32>
mpi::request gko::experimental::distributed::RowGatherer< LocalIndexType >::apply_async ( ptr_param< const LinOp > b,
ptr_param< LinOp > x ) const
nodiscard

Asynchronous version of LinOp::apply.

Warning
Only one mpi::request can be active at any given time. Calling this function again without waiting on the previous mpi::request will lead to undefined behavior.
Parameters
bthe input distributed::Vector.
xthe output matrix::Dense with the rows gathered from b. Its executor has to be compatible with the MPI implementation, see the class documentation.
Returns
a mpi::request for this task. The task is guaranteed to be completed only after .wait() has been called on it.

◆ apply_async() [2/2]

template<typename LocalIndexType = int32>
mpi::request gko::experimental::distributed::RowGatherer< LocalIndexType >::apply_async ( ptr_param< const LinOp > b,
ptr_param< LinOp > x,
array< char > & workspace ) const
nodiscard

Asynchronous version of LinOp::apply.

Warning
Calling this multiple times with the same workspace and without waiting on each previous request will lead to incorrect data transfers.
Parameters
bthe input distributed::Vector.
xthe output matrix::Dense with the rows gathered from b. Its executor has to be compatible with the MPI implementation, see the class documentation.
workspacea workspace to store temporary data for the operation. This might not be modified before the request is waited on.
Returns
a mpi::request for this task. The task is guaranteed to be completed only after .wait() has been called on it.

◆ create()

template<typename LocalIndexType = int32>
template<typename GlobalIndexType = int64>
std::unique_ptr< RowGatherer > gko::experimental::distributed::RowGatherer< LocalIndexType >::create ( std::shared_ptr< const Executor > exec,
std::shared_ptr< const mpi::CollectiveCommunicator > coll_comm,
const index_map< LocalIndexType, GlobalIndexType > & imap )
inlinestatic

Creates a distributed::RowGatherer from a given collective communicator and index map.

@TODO: using a segmented array instead of the imap would probably be more general

Template Parameters
GlobalIndexTypethe global index type of the index map
Parameters
execthe executor
coll_commthe collective communicator
imapthe index map defining which rows to gather
Note
The coll_comm and imap have to be compatible. The coll_comm must send and recv exactly as many rows as the imap defines.
This is a collective operation, all participating processes have to execute this operation.
Returns
a shared_ptr to the created distributed::RowGatherer

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