DOLFINx 0.10.0.0
DOLFINx C++ interface
|
#include <IndexMap.h>
Public Member Functions | |
IndexMap (MPI_Comm comm, std::int32_t local_size) | |
Create an non-overlapping index map. | |
IndexMap (MPI_Comm comm, std::int32_t local_size, std::span< const std::int64_t > ghosts, std::span< const int > owners, int tag=static_cast< int >(dolfinx::MPI::tag::consensus_nbx)) | |
Create an overlapping (ghosted) index map. | |
IndexMap (MPI_Comm comm, std::int32_t local_size, const std::array< std::vector< int >, 2 > &src_dest, std::span< const std::int64_t > ghosts, std::span< const int > owners) | |
Create an overlapping (ghosted) index map. | |
IndexMap (const IndexMap &map)=delete | |
IndexMap (IndexMap &&map)=default | |
Move constructor. | |
~IndexMap ()=default | |
Destructor. | |
IndexMap & | operator= (IndexMap &&map)=default |
Move assignment. | |
IndexMap & | operator= (const IndexMap &map)=delete |
std::array< std::int64_t, 2 > | local_range () const noexcept |
Range of indices (global) owned by this process. | |
std::int32_t | num_ghosts () const noexcept |
Number of ghost indices on this process. | |
std::int32_t | size_local () const noexcept |
Number of indices owned by this process. | |
std::int64_t | size_global () const noexcept |
Number indices across communicator. | |
std::span< const std::int64_t > | ghosts () const noexcept |
MPI_Comm | comm () const |
Return the MPI communicator that the map is defined on. | |
void | local_to_global (std::span< const std::int32_t > local, std::span< std::int64_t > global) const |
Compute global indices for array of local indices. | |
void | global_to_local (std::span< const std::int64_t > global, std::span< std::int32_t > local) const |
Compute local indices for array of global indices. | |
std::vector< std::int64_t > | global_indices () const |
Build list of indices with global indexing. | |
std::span< const int > | owners () const |
The ranks that own each ghost index. | |
graph::AdjacencyList< int > | index_to_dest_ranks (int tag=static_cast< int >(dolfinx::MPI::tag::consensus_nbx)) const |
Compute map from each local (owned) index to the set of ranks that have the index as a ghost. | |
std::vector< std::int32_t > | shared_indices () const |
Build a list of owned indices that are ghosted by another rank. | |
std::span< const int > | src () const noexcept |
Ordered set of MPI ranks that own caller's ghost indices. | |
std::span< const int > | dest () const noexcept |
Ordered set of MPI ranks that ghost indices owned by caller. | |
std::vector< std::int32_t > | weights_src () const |
Compute the number of ghost indices owned by each rank in IndexMap::src. | |
std::vector< std::int32_t > | weights_dest () const |
Compute the number of ghost indices owned by each rank in IndexMap::dest. | |
std::array< std::vector< int >, 2 > | rank_type (int split_type) const |
Destination and source ranks by type, e.g, ranks that are destination/source ranks for the caller and are in a common shared memory region. |
This class represents the distribution index arrays across processes. An index array is a contiguous collection of N+1 indices [0, 1, . . ., N] that are distributed across M processes. On a given process, the IndexMap stores a portion of the index set using local indices [0, 1, . . . , n], and a map from the local indices to a unique global index.
IndexMap | ( | MPI_Comm | comm, |
std::int32_t | local_size ) |
Create an non-overlapping index map.
[in] | comm | MPI communicator that the index map is distributed across. |
[in] | local_size | Local size of the index map, i.e. the number of owned entries. |
IndexMap | ( | MPI_Comm | comm, |
std::int32_t | local_size, | ||
std::span< const std::int64_t > | ghosts, | ||
std::span< const int > | owners, | ||
int | tag = static_cast<int>(dolfinx::MPI::tag::consensus_nbx) ) |
Create an overlapping (ghosted) index map.
This constructor uses a 'consensus' algorithm to determine the ranks that ghost indices that are owned by the caller. This requires non-trivial MPI communication. If the ranks that ghost indices owned by the caller are known, it more efficient to use the constructor that takes these ranks as an argument.
[in] | comm | MPI communicator that the index map is distributed across. |
[in] | local_size | Local size of the index map, i.e. the number of owned entries |
[in] | ghosts | The global indices of ghost entries |
[in] | owners | Owner rank (on comm) of each entry in ghosts |
[in] | tag | Tag used in non-blocking MPI calls in the consensus algorithm. |
IndexMap | ( | MPI_Comm | comm, |
std::int32_t | local_size, | ||
const std::array< std::vector< int >, 2 > & | src_dest, | ||
std::span< const std::int64_t > | ghosts, | ||
std::span< const int > | owners ) |
Create an overlapping (ghosted) index map.
This constructor is optimised for the case where the 'source' (ranks that own indices ghosted by the caller) and 'destination' ranks (ranks that ghost indices owned by the caller) are already available. It allows the complex computation of the destination ranks from owners.
[in] | comm | MPI communicator that the index map is distributed across. |
[in] | local_size | Local size of the index map, i.e. the number |
[in] | src_dest | Lists of [0] src and [1] dest ranks. The list in each must be sorted and not contain duplicates. src ranks are owners of the indices in ghosts. dest ranks are the rank that ghost indices owned by the caller. |
[in] | ghosts | The global indices of ghost entries |
[in] | owners | Owner rank (on comm) of each entry in ghosts |
MPI_Comm comm | ( | ) | const |
Return the MPI communicator that the map is defined on.
|
noexcept |
|
noexcept |
Local-to-global map for ghosts (local indexing beyond end of local range)
std::vector< std::int64_t > global_indices | ( | ) | const |
Build list of indices with global indexing.
void global_to_local | ( | std::span< const std::int64_t > | global, |
std::span< std::int32_t > | local ) const |
Compute local indices for array of global indices.
[in] | global | Global indices |
[out] | local | The local of the corresponding global index in 'global'. Returns -1 if the local index does not exist on this process. |
graph::AdjacencyList< int > index_to_dest_ranks | ( | int | tag = static_cast<int>(dolfinx::MPI::tag::consensus_nbx) | ) | const |
Compute map from each local (owned) index to the set of ranks that have the index as a ghost.
[in] | tag | Tag to pass to MPI calls. |
void local_to_global | ( | std::span< const std::int32_t > | local, |
std::span< std::int64_t > | global ) const |
Compute global indices for array of local indices.
[in] | local | Local indices |
[out] | global | The global indices |
|
inline |
The ranks that own each ghost index.
std::array< std::vector< int >, 2 > rank_type | ( | int | split_type | ) | const |
Destination and source ranks by type, e.g, ranks that are destination/source ranks for the caller and are in a common shared memory region.
This function is used to group destination and source ranks by 'type'. The type is defined by the MPI split_type. Split types include ranks from a common shared memory region (MPI_COMM_TYPE_SHARED) or a common NUMA region. Splits types are listed at https://docs.open-mpi.org/en/main/man-openmpi/man3/MPI_Comm_split_type.3.html#split-types.
[in] | split_type | MPI split type, as used in the function MPI_Comm_split_type. See https://docs.open-mpi.org/en/main/man-openmpi/man3/MPI_Comm_split_type.3.html#split-types. |
std::vector< std::int32_t > shared_indices | ( | ) | const |
Build a list of owned indices that are ghosted by another rank.
|
noexcept |
std::vector< std::int32_t > weights_dest | ( | ) | const |
Compute the number of ghost indices owned by each rank in IndexMap::dest.
This is a measure of the amount of data:
std::vector< std::int32_t > weights_src | ( | ) | const |
Compute the number of ghost indices owned by each rank in IndexMap::src.
This is a measure of the amount of data: