Ginkgo Generated from branch based on main. Ginkgo version 1.10.0
A numerical linear algebra library targeting many-core architectures
Loading...
Searching...
No Matches
index_map.hpp
1// SPDX-FileCopyrightText: 2017 - 2025 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_DISTRIBUTED_INDEX_MAP_HPP_
6#define GKO_PUBLIC_CORE_DISTRIBUTED_INDEX_MAP_HPP_
7
8
9#include <ginkgo/core/base/segmented_array.hpp>
10#include <ginkgo/core/distributed/partition.hpp>
11
12
13namespace gko {
14namespace experimental {
15namespace distributed {
16
17
28
29
67template <typename LocalIndexType, typename GlobalIndexType = int64>
68class index_map {
69public:
70 using partition_type = Partition<LocalIndexType, GlobalIndexType>;
71
83 index_space index_space_v) const;
84
85
97 const array<LocalIndexType>& local_idxs,
98 index_space index_space_v) const;
99
104
109
114
127 index_map(std::shared_ptr<const Executor> exec,
128 std::shared_ptr<const partition_type> partition,
129 comm_index_type rank,
130 const array<GlobalIndexType>& recv_connections);
131
135 index_map(std::shared_ptr<const Executor> exec);
136
143
159
167
171 std::shared_ptr<const Executor> get_executor() const;
172
173 index_map(const index_map& other);
174
175 index_map(index_map&& other) noexcept;
176
177 index_map& operator=(const index_map& other);
178
179 index_map& operator=(index_map&& other);
180
181private:
182 std::shared_ptr<const Executor> exec_;
183 std::shared_ptr<const partition_type> partition_;
184 comm_index_type rank_;
185
186 array<comm_index_type> remote_target_ids_;
187 segmented_array<LocalIndexType> remote_local_idxs_;
188 segmented_array<GlobalIndexType> remote_global_idxs_;
189};
190
191
192} // namespace distributed
193} // namespace experimental
194} // namespace gko
195
196
197#endif // GKO_PUBLIC_CORE_DISTRIBUTED_INDEX_MAP_HPP_
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition array.hpp:166
Represents a partition of a range of indices [0, size) into a disjoint set of parts.
Definition partition.hpp:83
index_map(std::shared_ptr< const Executor > exec, std::shared_ptr< const partition_type > partition, comm_index_type rank, const array< GlobalIndexType > &recv_connections)
Creates a new index map.
const array< comm_index_type > & get_remote_target_ids() const
get the rank ids which contain indices accessed by this rank.
size_type get_local_size() const
get size of index_space::local
size_type get_global_size() const
get size of the global index space
array< LocalIndexType > map_to_local(const array< GlobalIndexType > &global_ids, index_space index_space_v) const
Maps global indices to local indices.
size_type get_non_local_size() const
get size of index_space::non_local
index_map(std::shared_ptr< const Executor > exec)
Creates an empty index map.
const segmented_array< GlobalIndexType > & get_remote_global_idxs() const
get the index set for this rank.
const segmented_array< LocalIndexType > & get_remote_local_idxs() const
get the index set , but mapped to their respective local index space.
std::shared_ptr< const Executor > get_executor() const
get the associated executor.
array< GlobalIndexType > map_to_global(const array< LocalIndexType > &local_idxs, index_space index_space_v) const
Maps local indices to global indices.
The distributed namespace.
Definition polymorphic_object.hpp:19
index_space
Index space classification for the locally stored indices.
Definition index_map.hpp:23
@ combined
both local and non_local indices
Definition index_map.hpp:26
@ non_local
indices that are owned by other processes
Definition index_map.hpp:25
@ local
indices that are locally owned
Definition index_map.hpp:24
int comm_index_type
Index type for enumerating processes in a distributed application.
Definition types.hpp:1060
The Ginkgo namespace.
Definition abstract_factory.hpp:20
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:90
A minimal interface for a segmented array.
Definition segmented_array.hpp:27