|
DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
|
Mapping between a rank's main data and its ghost copies. More...
#include <IndexMapping.hpp>
Public Member Functions | |
| template<class TpullSet > | |
| OffsetAscendIndexMapping (index nmainOffset, index nmainSize, TpullSet &&pullingIndexGlobal, const GlobalOffsetsMapping &LGlobalMapping, const MPIInfo &mpi) | |
| Construct the mapping from a pull specification. | |
| template<class TpushSet , class TpushStart > | |
| OffsetAscendIndexMapping (index nmainOffset, index nmainSize, TpushSet &&pushingIndexesLocal, TpushStart &&pushingStarts, const GlobalOffsetsMapping &LGlobalMapping, const MPIInfo &mpi) | |
| Construct the mapping from a push specification. | |
| void | sort () |
Sort ghostIndex into ascending order. Required invariant maintained after pull construction. | |
| index & | ghostAt (MPI_int rank, index ighost) |
Direct mutable access to the ighost-th ghost global index for peer rank. | |
| bool | searchInMain (index globalQuery, index &val) const |
| Check whether a global index lies within the main block. | |
| bool | searchInGhost (index globalQuery, MPI_int rank, index &val) const |
| Search a single peer rank's ghost slab for a global index. | |
| bool | searchInAllGhost (index globalQuery, MPI_int &rank, index &val) const |
| Search the concatenated ghost array for a global index (O(log nGhost)). | |
| bool | search (index globalQuery, MPI_int &rank, index &val) const |
Search main + ghost in one call. rank == -1 signals "hit in main". | |
| std::tuple< bool, MPI_int, index > | search (index globalQuery) const |
Tuple-return overload of the main search. (success, rank, local). | |
| bool | search_indexAppend (index globalQuery, MPI_int &rank, index &val) const |
Like search, but the returned val is in the concatenated father+son address space. | |
| std::tuple< bool, MPI_int, index > | search_indexAppend (index globalQuery) const |
| Tuple-return overload of search_indexAppend. | |
| bool | search_indexRank (index globalQuery, MPI_int &rank, index &val) const |
Like search, but val is expressed relative to the owner rank's ghost slab (ghostStart[rank]-relative). | |
| std::tuple< bool, MPI_int, index > | search_indexRank (index globalQuery) const |
| Tuple-return overload of search_indexRank. | |
| index | operator() (MPI_int rank, index val) const |
| Reverse (local -> global) mapping. | |
Public Attributes | |
| tMPI_intVec | ghostSizes |
Number of ghost rows pulled from each peer rank. (a.k.a. pullIndexSizes) | |
| t_IndexVec | ghostIndex |
Global indices of all ghost rows on this rank, ascending. (a.k.a. pullingIndexGlobal) | |
| t_MapIndexVec | ghostStart |
Per-peer prefix-sum offsets into ghostIndex (size == nRanks + 1). (a.k.a. pullIndexStarts) | |
| tMPI_intVec | pushIndexSizes |
| Per-peer number of rows this rank will send out on a push. | |
| t_MapIndexVec | pushIndexStarts |
Per-peer prefix-sum offsets into pushingIndexGlobal. | |
| t_IndexVec | pushingIndexGlobal |
| Global indices this rank sends to others, grouped by receiver. | |
| t_IndexVec | pullingRequestLocal |
| Optional cached local-index form of ghostIndex (unused in current code). | |
Mapping between a rank's main data and its ghost copies.
main data (owned rows) is a contiguous range [mainOffset, mainOffset + mainSize) in the global index space. ghost data (rows needed from other ranks) is stored in globally ascending order so that binary search may be used for the reverse mapping.
Two construction modes:
MPI_Alltoall(v) so the resulting mapping is valid on both sides.Internal structure (all vectors are per-peer-rank layouts, sorted by rank):
ghostSizes / ghostStart / ghostIndex: what this rank pulls from each other rank.pushIndexSizes / pushIndexStarts / pushingIndexGlobal: what this rank sends to each other rank.int32_t. Definition at line 165 of file IndexMapping.hpp.
|
inline |
Construct the mapping from a pull specification.
| TpullSet | Range of index (vector-like, supports sort/unique/erase). |
| nmainOffset | Global offset of this rank's main data block. |
| nmainSize | Number of main rows owned by this rank. |
| pullingIndexGlobal | Global indices this rank wants to see as ghosts. Sorted and deduplicated in-place. |
| LGlobalMapping | Globally-known offsets, used to attribute each global index to its owner rank. |
| mpi | MPI context; the constructor is collective. |
pullingIndexGlobal is mutated (sorted / uniquified / shrunk). The resulting ghostIndex ends up in ascending global-index order regardless of the caller's original ordering. *make sorted and unique!
Definition at line 214 of file IndexMapping.hpp.
|
inline |
Construct the mapping from a push specification.
The caller supplies, for every peer rank, a list of local row indices that this rank should send. The constructor flips this into the pull view via MPI_Alltoall(v).
| TpushSet | Range-like of local indices. |
| TpushStart | Size-nRanks+1 prefix-sum offsets. |
| nmainOffset | Global offset of this rank's main block. |
| nmainSize | Number of main rows owned by this rank. |
| pushingIndexesLocal | Local indices to push, grouped by receiver (flat array; [pushingStarts[r], pushingStarts[r+1]) are the indices going to rank r). |
| pushingStarts | Prefix sums of per-receiver counts, size nRanks+1. |
| LGlobalMapping | Rank-offset table (to convert local -> global). |
| mpi | MPI context; collective. |
Definition at line 297 of file IndexMapping.hpp.
Direct mutable access to the ighost-th ghost global index for peer rank.
Definition at line 344 of file IndexMapping.hpp.
Reverse (local -> global) mapping.
rank == -1: val indexes the concatenated father+son address space. val < mainSize returns the main global index; val >= mainSize returns the corresponding ghost global index.rank >= 0: val indexes into that peer's ghost slab (like search_indexRank's output).if rank == -1, return the global index of local main data, or else return the ghosted global index of local ghost data.
Definition at line 509 of file IndexMapping.hpp.
|
inline |
Tuple-return overload of the main search. (success, rank, local).
Definition at line 432 of file IndexMapping.hpp.
|
inline |
Search main + ghost in one call. rank == -1 signals "hit in main".
Returned val is in the ghost address space (relative to ghostStart[0]) when rank != -1, else it is the main-local index. See also search_indexAppend for the combined (father+son) index space.
returns rank and place in ghost array, rank==-1 means main data
Definition at line 418 of file IndexMapping.hpp.
|
inline |
Tuple-return overload of search_indexAppend.
Definition at line 462 of file IndexMapping.hpp.
|
inline |
Like search, but the returned val is in the concatenated father+son address space.
val < mainSize means main row; val >= mainSize means ghost row at val - mainSize. Matches ArrayPair::operator[] layout.
returns rank and place in ghost array, rank==-1 means main data; returned val is used for pair indexing
Definition at line 446 of file IndexMapping.hpp.
|
inline |
Tuple-return overload of search_indexRank.
Definition at line 492 of file IndexMapping.hpp.
|
inline |
Like search, but val is expressed relative to the owner rank's ghost slab (ghostStart[rank]-relative).
val is relative to the concatenated ghost array.returns rank and place in ghost of rank, rank==-1 means main data
Definition at line 476 of file IndexMapping.hpp.
|
inline |
Search the concatenated ghost array for a global index (O(log nGhost)).
| [out] | rank | Peer rank that owns the found index. |
| [out] | val | Offset relative to ghostStart[0] (== 0). |
Definition at line 395 of file IndexMapping.hpp.
|
inline |
Search a single peer rank's ghost slab for a global index.
| [out] | val | Offset relative to ghostStart[rank] on success. |
Definition at line 375 of file IndexMapping.hpp.
Check whether a global index lies within the main block.
| globalQuery | Global index to look up. | |
| [out] | val | On success, local offset within the main block. |
globalQuery is owned by this rank. Definition at line 361 of file IndexMapping.hpp.
|
inline |
Sort ghostIndex into ascending order. Required invariant maintained after pull construction.
Definition at line 338 of file IndexMapping.hpp.
| t_IndexVec DNDS::OffsetAscendIndexMapping::ghostIndex |
Global indices of all ghost rows on this rank, ascending. (a.k.a. pullingIndexGlobal)
Definition at line 179 of file IndexMapping.hpp.
| tMPI_intVec DNDS::OffsetAscendIndexMapping::ghostSizes |
Number of ghost rows pulled from each peer rank. (a.k.a. pullIndexSizes)
Definition at line 175 of file IndexMapping.hpp.
| t_MapIndexVec DNDS::OffsetAscendIndexMapping::ghostStart |
Per-peer prefix-sum offsets into ghostIndex (size == nRanks + 1). (a.k.a. pullIndexStarts)
Definition at line 183 of file IndexMapping.hpp.
| t_IndexVec DNDS::OffsetAscendIndexMapping::pullingRequestLocal |
Optional cached local-index form of ghostIndex (unused in current code).
Encoding: >=0 means array[i], <0 means ghost_array[-i-1]. Retained for potential future reconstruction paths.
Definition at line 195 of file IndexMapping.hpp.
| tMPI_intVec DNDS::OffsetAscendIndexMapping::pushIndexSizes |
Per-peer number of rows this rank will send out on a push.
Definition at line 186 of file IndexMapping.hpp.
| t_MapIndexVec DNDS::OffsetAscendIndexMapping::pushIndexStarts |
Per-peer prefix-sum offsets into pushingIndexGlobal.
Definition at line 188 of file IndexMapping.hpp.
| t_IndexVec DNDS::OffsetAscendIndexMapping::pushingIndexGlobal |
Global indices this rank sends to others, grouped by receiver.
Definition at line 190 of file IndexMapping.hpp.