 |
Ginkgo
Generated from pipelines/3035309441 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_DISTRIBUTED_ROW_SCATTERER_HPP_
6 #define GKO_PUBLIC_CORE_DISTRIBUTED_ROW_SCATTERER_HPP_
9 #include <ginkgo/config.hpp>
15 #include <ginkgo/core/base/dense_cache.hpp>
16 #include <ginkgo/core/base/lin_op.hpp>
17 #include <ginkgo/core/base/mpi.hpp>
18 #include <ginkgo/core/distributed/base.hpp>
19 #include <ginkgo/core/distributed/collective_communicator.hpp>
20 #include <ginkgo/core/distributed/index_map.hpp>
21 #include <ginkgo/core/distributed/row_gatherer.hpp>
25 namespace experimental {
26 namespace distributed {
60 template <
typename LocalIndexType =
int32>
61 class RowScatterer final :
public PolymorphicObject,
62 public EnableCloneable<RowScatterer<LocalIndexType>>,
63 public DistributedBase {
64 friend class EnableCloneable<RowScatterer>;
81 void apply_async(ptr_param<const LinOp> local_values)
const;
104 std::shared_ptr<const mpi::CollectiveCommunicator>
133 template <
typename GlobalIndexType =
int64,
134 typename = std::enable_if_t<
sizeof(GlobalIndexType) >=
135 sizeof(LocalIndexType)>>
136 static std::unique_ptr<RowScatterer>
create(
137 std::shared_ptr<const Executor> exec,
138 std::shared_ptr<const mpi::CollectiveCommunicator> coll_comm,
141 return std::unique_ptr<RowScatterer>(
142 new RowScatterer(std::move(exec), std::move(coll_comm), imap));
158 std::shared_ptr<const Executor> exec,
164 static std::unique_ptr<RowScatterer>
create(
176 template <
typename GlobalIndexType>
178 std::shared_ptr<const mpi::CollectiveCommunicator> coll_comm,
184 std::shared_ptr<const mpi::CollectiveCommunicator> coll_comm,
188 std::shared_ptr<const mpi::CollectiveCommunicator> coll_comm_;
190 mutable gko::detail::GenericDenseCache send_cache_;
194 mutable std::shared_ptr<LinOp> recv_buffer_;
195 mutable gko::detail::GenericDenseCache recv_cache_;
204 #endif // GKO_PUBLIC_CORE_DISTRIBUTED_ROW_SCATTERER_HPP_
The distributed::RowGatherer gathers the rows of distributed::Vector that are located on other proces...
Definition: row_gatherer.hpp:30
dim< 2 > get_size() const
Returns the size of the row scatterer.
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:101
void wait_and_accumulate(ptr_param< LinOp > distributed_target) const
Wait for the scatter communication to complete and accumulate received values into the target: target...
static std::unique_ptr< RowScatterer > create(std::shared_ptr< const Executor > exec, std::shared_ptr< const mpi::CollectiveCommunicator > coll_comm, const index_map< LocalIndexType, GlobalIndexType > &imap)
Creates a distributed::RowScatterer from a given collective communicator and index map.
Definition: row_scatterer.hpp:136
The request class is a light, move-only wrapper around the MPI_Request handle.
Definition: mpi.hpp:330
size_type get_num_recv_idxs() const
Returns the number of (local) row indices.
The Ginkgo namespace.
Definition: abstract_factory.hpp:19
A thin wrapper of MPI_Comm that supports most MPI calls.
Definition: mpi.hpp:418
const LocalIndexType * get_const_recv_idxs() const
Read access to the (local) row indices into which the received values are accumulated.
This class is used for function parameters in the place of raw pointers.
Definition: utils_helper.hpp:43
std::shared_ptr< const mpi::CollectiveCommunicator > get_collective_communicator() const
Get the used collective communicator.
std::int64_t int64
64-bit signed integral type.
Definition: types.hpp:124
void apply_async(ptr_param< const LinOp > local_values) const
Start scattering local values to their owning ranks.
static std::unique_ptr< RowScatterer > create_from_gatherer(std::shared_ptr< const Executor > exec, ptr_param< const RowGatherer< LocalIndexType >> gatherer)
Creates a distributed::RowScatterer from an existing RowGatherer.
The distributed::RowScatterer scatters local values to their owning processes and accumulates receive...
Definition: row_gatherer.hpp:33
This class defines mappings between global and local indices.
Definition: index_map.hpp:70