5#ifndef GKO_PUBLIC_CORE_DISTRIBUTED_ROW_GATHERER_HPP_
6#define GKO_PUBLIC_CORE_DISTRIBUTED_ROW_GATHERER_HPP_
9#include <ginkgo/config.hpp>
15#include <ginkgo/core/base/dense_cache.hpp>
16#include <ginkgo/core/base/event.hpp>
17#include <ginkgo/core/base/lin_op.hpp>
18#include <ginkgo/core/base/mpi.hpp>
19#include <ginkgo/core/distributed/base.hpp>
20#include <ginkgo/core/distributed/collective_communicator.hpp>
21#include <ginkgo/core/distributed/index_map.hpp>
25namespace experimental {
29template <
typename LocalIndexType>
37template <
typename LocalIndexType>
38std::shared_ptr<const gko::detail::Event> apply_prepare(
39 const RowGatherer<LocalIndexType>* rg, ptr_param<const LinOp> b);
42template <
typename LocalIndexType>
43std::shared_ptr<const gko::detail::Event> apply_prepare(
44 const RowGatherer<LocalIndexType>* rg, ptr_param<const LinOp> b,
45 array<char>& workspace);
48template <
typename LocalIndexType>
49mpi::request apply_finalize(
const RowGatherer<LocalIndexType>* rg,
50 ptr_param<const LinOp> b, ptr_param<LinOp> x,
51 std::shared_ptr<const gko::detail::Event>);
54template <
typename LocalIndexType>
55mpi::request apply_finalize(
const RowGatherer<LocalIndexType>* rg,
56 ptr_param<const LinOp> b, ptr_param<LinOp> x,
57 std::shared_ptr<const gko::detail::Event>,
58 array<char>& workspace);
90template <
typename LocalIndexType =
int32>
91class RowGatherer final
94 public DistributedBase {
96 template <
typename ValueT,
typename LocalIndexT,
typename GlobalIndexT>
99 friend std::shared_ptr<const gko::detail::Event>
100 detail::apply_prepare<LocalIndexType>(
const RowGatherer* rg,
102 friend std::shared_ptr<const gko::detail::Event>
103 detail::apply_prepare<LocalIndexType>(
const RowGatherer* rg,
106 friend mpi::request detail::apply_finalize<LocalIndexType>(
108 std::shared_ptr<const gko::detail::Event>);
109 friend mpi::request detail::apply_finalize<LocalIndexType>(
111 std::shared_ptr<const gko::detail::Event>,
array<char>& workspace);
162 std::shared_ptr<const mpi::CollectiveCommunicator>
195 template <
typename GlobalIndexType =
int64,
196 typename = std::enable_if_t<
sizeof(GlobalIndexType) >=
197 sizeof(LocalIndexType)>>
198 static std::unique_ptr<RowGatherer>
create(
199 std::shared_ptr<const Executor> exec,
200 std::shared_ptr<const mpi::CollectiveCommunicator> coll_comm,
203 return std::unique_ptr<RowGatherer>(
204 new RowGatherer(std::move(exec), std::move(coll_comm), imap));
210 static std::unique_ptr<RowGatherer>
create(
229 static std::unique_ptr<RowGatherer>
create(
230 std::shared_ptr<const Executor> exec,
231 std::shared_ptr<const mpi::CollectiveCommunicator> coll_comm_template);
242 std::shared_ptr<const gko::detail::Event> apply_prepare(
245 std::shared_ptr<const gko::detail::Event> apply_prepare(
250 std::shared_ptr<const gko::detail::Event>)
const;
253 std::shared_ptr<const gko::detail::Event>,
262 template <
typename GlobalIndexType>
264 std::shared_ptr<const mpi::CollectiveCommunicator> coll_comm,
278 std::shared_ptr<const Executor> exec,
279 std::shared_ptr<const mpi::CollectiveCommunicator> coll_comm_template);
282 std::shared_ptr<const mpi::CollectiveCommunicator> coll_comm_;
This mixin is used to enable a default PolymorphicObject::copy_from() implementation for objects that...
Definition polymorphic_object.hpp:743
This mixin inherits from (a subclass of) PolymorphicObject and provides a base implementation of a ne...
Definition polymorphic_object.hpp:668
A PolymorphicObject is the abstract base for all "heavy" objects in Ginkgo that behave polymorphicall...
Definition polymorphic_object.hpp:52
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition array.hpp:166
The distributed::RowGatherer gathers the rows of distributed::Vector that are located on other proces...
Definition row_gatherer.hpp:94
mpi::request apply_async(ptr_param< const LinOp > b, ptr_param< LinOp > x, array< char > &workspace) const
Asynchronous version of LinOp::apply.
mpi::request apply_async(ptr_param< const LinOp > b, ptr_param< LinOp > x) const
Asynchronous version of LinOp::apply.
const LocalIndexType * get_const_send_idxs() const
Read access to the (local) rows indices.
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
dim< 2 > get_size() const
Returns the size of the row gatherer.
size_type get_num_send_idxs() const
Returns the number of (local) row indices.
std::shared_ptr< const mpi::CollectiveCommunicator > get_collective_communicator() const
Get the used collective communicator.
This class defines mappings between global and local indices.
Definition index_map.hpp:68
A thin wrapper of MPI_Comm that supports most MPI calls.
Definition mpi.hpp:419
The request class is a light, move-only wrapper around the MPI_Request handle.
Definition mpi.hpp:331
This class is used for function parameters in the place of raw pointers.
Definition utils_helper.hpp:41
The distributed namespace.
Definition polymorphic_object.hpp:19
The Ginkgo namespace.
Definition abstract_factory.hpp:20
std::int64_t int64
64-bit signed integral type.
Definition types.hpp:113
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:90
A type representing the dimensions of a multidimensional object.
Definition dim.hpp:26