Ginkgo  Generated from pipelines/1554403166 branch based on develop. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
Public Types | Public Member Functions | List of all members
gko::experimental::distributed::index_map< LocalIndexType, GlobalIndexType > Struct Template Reference

This class defines mappings between global and local indices. More...

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

Public Types

using partition_type = Partition< LocalIndexType, GlobalIndexType >
 

Public Member Functions

array< LocalIndexType > map_to_local (const array< GlobalIndexType > &global_ids, index_space index_space_v) const
 Maps global indices to local indices. More...
 
size_type get_global_size () const
 get size of index_space::local
 
size_type get_local_size () const
 get size of index_space::local
 
size_type get_non_local_size () const
 get size of index_space::non_local
 
 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. More...
 
 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 $R_k$ for this rank. More...
 
const segmented_array< LocalIndexType > & get_remote_local_idxs () const
 get the index set $R_k$, but mapped to their respective local index space. More...
 
const array< comm_index_type > & get_remote_target_ids () const
 get the rank ids which contain indices accessed by this rank. More...
 
std::shared_ptr< const Executorget_executor () const
 get the associated executor.
 
 index_map (const index_map &other)
 
 index_map (index_map &&other) noexcept
 
index_mapoperator= (const index_map &other)
 
index_mapoperator= (index_map &&other)
 

Detailed Description

template<typename LocalIndexType, typename GlobalIndexType = int64>
struct gko::experimental::distributed::index_map< LocalIndexType, GlobalIndexType >

This class defines mappings between global and local indices.

Given an index space $I = [0, \dots, N)$ that is partitioned into $P$ disjoint subsets $I_k, k = 1, \dots, P$, this class defines for each subset an extended global index set $\hat{I}_k \supset I_K$. The extended index set contains the global indices owned by part $k$, as well as remote indices $R_k = \hat{I}_k \setminus I_k$, which are also accessed by part $k$, but owned by parts $l \neq k$. At the core, this class provides mappings from the global index space $I$ into different local index spaces. The combined local index space (index_space::combined) is then defined as $[0, \dots, |\hat{I}_k|)$. Additionally, the combined index space can be separated into locally owned (index_space::local) and non-locally owned (index_space::non_local). The locally owned indices are defined as $[0, \dots, |I_k|)$, and the non-locally owned as $[0, \dots, |R_k|)$. With these index sets, the following mappings are defined:

The required map can be selected by passing the appropriate type of an index_space.

The index map for $I_k$ has no knowledge about any other index maps for $I_l, l \neq k$. In particular, any global index passed to the map_to_local map that is not part of the specified index space, will be mapped to an invalid_index.

Template Parameters
LocalIndexTypetype for local indices
GlobalIndexTypetype for global indices

Constructor & Destructor Documentation

◆ index_map()

template<typename LocalIndexType , typename GlobalIndexType = int64>
gko::experimental::distributed::index_map< LocalIndexType, GlobalIndexType >::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.

The passed in recv_connections may contain duplicates, which will be filtered out.

Parameters
execthe executor
partitionthe partition of the global index set
rankthe id of the global index space subset
recv_connectionsthe global indices that are not owned by this rank, but accessed by it

Member Function Documentation

◆ get_remote_global_idxs()

template<typename LocalIndexType , typename GlobalIndexType = int64>
const segmented_array<GlobalIndexType>& gko::experimental::distributed::index_map< LocalIndexType, GlobalIndexType >::get_remote_global_idxs ( ) const

get the index set $R_k$ for this rank.

The indices are ordered by their owning rank and global index.

◆ get_remote_local_idxs()

template<typename LocalIndexType , typename GlobalIndexType = int64>
const segmented_array<LocalIndexType>& gko::experimental::distributed::index_map< LocalIndexType, GlobalIndexType >::get_remote_local_idxs ( ) const

get the index set $R_k$, but mapped to their respective local index space.

The indices are grouped by their owning rank and sorted according to their global index within each group.

The set $R_k = \hat{I}_k \setminus I_k$ can also be written as the union of the intersection of $\hat{I}_k$ with other disjoint sets $I_l, l \neq k$, i.e. $R_k = \bigcup_{j \neq k} \hat{I}_k \cap I_j = \bigcup_{j \neq k} R_{k,j}$. The set $R_{k,j}$ can then be mapped by $l_j$ to get the local indices wrt. part $j$. The indices here are mapped by $l_j$.

◆ get_remote_target_ids()

template<typename LocalIndexType , typename GlobalIndexType = int64>
const array<comm_index_type>& gko::experimental::distributed::index_map< LocalIndexType, GlobalIndexType >::get_remote_target_ids ( ) const

get the rank ids which contain indices accessed by this rank.

The order matches the order of the sets in get_remote_global_idxs and get_remote_local_idxs.

◆ map_to_local()

template<typename LocalIndexType , typename GlobalIndexType = int64>
array<LocalIndexType> gko::experimental::distributed::index_map< LocalIndexType, GlobalIndexType >::map_to_local ( const array< GlobalIndexType > &  global_ids,
index_space  index_space_v 
) const

Maps global indices to local indices.

Parameters
global_idsthe global indices to map
index_space_vthe index space in which the returned local indices are defined
Returns
the mapped local indices. Any global index that is not in the specified index space is mapped to invalid_index.

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