Ginkgo  Generated from pipelines/2011557978 branch based on develop. Ginkgo version 1.11.0
A numerical linear algebra library targeting many-core architectures
Public Member Functions | Static Public Member Functions | Friends | List of all members
gko::experimental::distributed::RowGatherer< LocalIndexType > Class Template Referencefinal

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. More...
 
mpi::request apply_async (ptr_param< const LinOp > b, ptr_param< LinOp > x, array< char > &workspace) const
 Asynchronous version of LinOp::apply. More...
 
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
 
RowGathereroperator= (const RowGatherer &o)
 
RowGathereroperator= (RowGatherer &&o)
 
- Public Member Functions inherited from gko::EnableAbstractPolymorphicObject< RowGatherer< LocalIndexType >, PolymorphicObject >
std::unique_ptr< RowGatherer< LocalIndexType > > create_default (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< RowGatherer< LocalIndexType > > create_default () const
 
std::unique_ptr< RowGatherer< LocalIndexType > > clone (std::shared_ptr< const Executor > exec) const
 
std::unique_ptr< RowGatherer< LocalIndexType > > clone () const
 
RowGatherer< LocalIndexType > * copy_from (const PolymorphicObject *other)
 
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, RowGatherer< LocalIndexType > > * copy_from (std::unique_ptr< Derived > &&other)
 
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, RowGatherer< LocalIndexType > > * copy_from (const std::unique_ptr< Derived > &other)
 
RowGatherer< LocalIndexType > * copy_from (const std::shared_ptr< const PolymorphicObject > &other)
 
RowGatherer< LocalIndexType > * move_from (ptr_param< PolymorphicObject > other)
 
RowGatherer< LocalIndexType > * clear ()
 
- Public Member Functions inherited from gko::PolymorphicObject
PolymorphicObjectoperator= (const PolymorphicObject &)
 
std::unique_ptr< PolymorphicObjectcreate_default (std::shared_ptr< const Executor > exec) const
 Creates a new "default" object of the same dynamic type as this object. More...
 
std::unique_ptr< PolymorphicObjectcreate_default () const
 Creates a new "default" object of the same dynamic type as this object. More...
 
std::unique_ptr< PolymorphicObjectclone (std::shared_ptr< const Executor > exec) const
 Creates a clone of the object. More...
 
std::unique_ptr< PolymorphicObjectclone () const
 Creates a clone of the object. More...
 
PolymorphicObjectcopy_from (const PolymorphicObject *other)
 Copies another object into this object. More...
 
template<typename Derived , typename Deleter >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * copy_from (std::unique_ptr< Derived, Deleter > &&other)
 Moves another object into this object. More...
 
template<typename Derived , typename Deleter >
std::enable_if_t< std::is_base_of< PolymorphicObject, std::decay_t< Derived > >::value, PolymorphicObject > * copy_from (const std::unique_ptr< Derived, Deleter > &other)
 Copies another object into this object. More...
 
PolymorphicObjectcopy_from (const std::shared_ptr< const PolymorphicObject > &other)
 Copies another object into this object. More...
 
PolymorphicObjectmove_from (ptr_param< PolymorphicObject > other)
 Moves another object into this object. More...
 
PolymorphicObjectclear ()
 Transforms the object into its default state. More...
 
std::shared_ptr< const Executorget_executor () const noexcept
 Returns the Executor of the object. More...
 
- Public Member Functions inherited from gko::log::EnableLogging< PolymorphicObject >
void add_logger (std::shared_ptr< const Logger > logger) override
 
void remove_logger (const Logger *logger) override
 
void remove_logger (ptr_param< const Logger > logger)
 
const std::vector< std::shared_ptr< const Logger > > & get_loggers () const override
 
void clear_loggers () override
 
- Public Member Functions inherited from gko::log::Loggable
void remove_logger (ptr_param< const Logger > logger)
 
- Public Member Functions inherited from gko::EnablePolymorphicAssignment< RowGatherer< LocalIndexType > >
void convert_to (result_type *result) const override
 Converts the implementer to an object of type result_type. More...
 
void move_to (result_type *result) override
 Converts the implementer to an object of type result_type by moving data from this object. More...
 
- Public Member Functions inherited from gko::ConvertibleTo< RowGatherer< LocalIndexType > >
void convert_to (ptr_param< result_type > result) const
 
void move_to (ptr_param< result_type > result)
 
- Public Member Functions inherited from gko::experimental::distributed::DistributedBase
 DistributedBase (const DistributedBase &other)=default
 
 DistributedBase (DistributedBase &&other)=default
 
DistributedBaseoperator= (const DistributedBase &)
 Copy assignment that doesn't change the used mpi::communicator. More...
 
DistributedBaseoperator= (DistributedBase &&) noexcept
 Move assignment that doesn't change the used mpi::communicator. More...
 
mpi::communicator get_communicator () const
 Access the used mpi::communicator. More...
 

Static Public Member Functions

template<typename GlobalIndexType = int64, typename = std::enable_if_t<sizeof(GlobalIndexType) >= sizeof(LocalIndexType)>
static std::unique_ptr< RowGatherercreate (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. More...
 
static std::unique_ptr< RowGatherercreate (std::shared_ptr< const Executor > exec, mpi::communicator comm)
 

Friends

class EnablePolymorphicObject< RowGatherer, PolymorphicObject >
 

Additional Inherited Members

- Public Types inherited from gko::EnablePolymorphicAssignment< RowGatherer< LocalIndexType > >
using result_type = RowGatherer< LocalIndexType >
 
- Public Types inherited from gko::ConvertibleTo< RowGatherer< LocalIndexType > >
using result_type = RowGatherer< LocalIndexType >
 

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:

{c++}
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
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

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

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, typename = std::enable_if_t<sizeof(GlobalIndexType) >= sizeof(LocalIndexType)>
static 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:
gko::matrix::Dense::create
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.
gko::experimental::distributed::Vector::create
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.
gko::experimental::distributed::RowGatherer::create
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:146