DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
Loading...
Searching...
No Matches
DNDS::GlobalOffsetsMapping Class Reference

Table mapping rank-local row indices to the global index space. More...

#include <IndexMapping.hpp>

Public Member Functions

t_IndexVecRLengths ()
 Per-rank lengths vector (size == nRanks).
 
t_IndexVecROffsets ()
 Prefix-sum offsets vector (size == nRanks + 1, last element == globalSize).
 
index globalSize () const
 Total number of rows across all ranks.
 
void setMPIAlignBcast (const MPIInfo &mpi, index myLength)
 Broadcast each rank's length, then compute the global prefix sums.
 
index operator() (MPI_int rank, index val) const
 Convert a (rank, local) pair to a global index.
 
bool search (index globalQuery, MPI_int &rank, index &val) const
 Convert a global index to (rank, local). Returns false if out of range.
 
std::tuple< bool, MPI_int, indexsearch (index globalQuery) const
 

Detailed Description

Table mapping rank-local row indices to the global index space.

Every rank owns a contiguous chunk in the global index space:

rank: 0 1 2
RankLengths = [ 3, 4, 5 ]
RankOffsets = [ 0, 3, 7, 12 ] # prefix sum, size == nRanks + 1

After setMPIAlignBcast, every rank holds an identical copy of the table (it is globally replicated), so both local-to-global (operator()) and global-to-local (search) queries are purely local. Used by ParArraycreateGlobalMapping and friends.

Definition at line 44 of file IndexMapping.hpp.

Member Function Documentation

◆ globalSize()

index DNDS::GlobalOffsetsMapping::globalSize ( ) const
inline

Total number of rows across all ranks.

Definition at line 58 of file IndexMapping.hpp.

Here is the caller graph for this function:

◆ operator()()

index DNDS::GlobalOffsetsMapping::operator() ( MPI_int  rank,
index  val 
) const
inline

Convert a (rank, local) pair to a global index.

Equivalent to RankOffsets[rank] + val, with asserts.

Definition at line 95 of file IndexMapping.hpp.

◆ RLengths()

t_IndexVec & DNDS::GlobalOffsetsMapping::RLengths ( )
inline

Per-rank lengths vector (size == nRanks).

Definition at line 53 of file IndexMapping.hpp.

Here is the caller graph for this function:

◆ ROffsets()

t_IndexVec & DNDS::GlobalOffsetsMapping::ROffsets ( )
inline

Prefix-sum offsets vector (size == nRanks + 1, last element == globalSize).

Definition at line 55 of file IndexMapping.hpp.

Here is the caller graph for this function:

◆ search() [1/2]

std::tuple< bool, MPI_int, index > DNDS::GlobalOffsetsMapping::search ( index  globalQuery) const
inline

Definition at line 133 of file IndexMapping.hpp.

Here is the call graph for this function:

◆ search() [2/2]

bool DNDS::GlobalOffsetsMapping::search ( index  globalQuery,
MPI_int rank,
index val 
) const
inline

Convert a global index to (rank, local). Returns false if out of range.

Uses std::lower_bound on the offsets table (O(log nRanks)).

Parameters
globalQueryGlobal index.
[out]rankOwning rank on success.
[out]valLocal offset within the owner.
Returns
true if globalQuery lies within [0, globalSize()).

Definition at line 114 of file IndexMapping.hpp.

Here is the caller graph for this function:

◆ setMPIAlignBcast()

void DNDS::GlobalOffsetsMapping::setMPIAlignBcast ( const MPIInfo mpi,
index  myLength 
)
inline

Broadcast each rank's length, then compute the global prefix sums.

Collective call. After it returns, every rank holds the full RLengths / ROffsets tables. Called by ParArray::createGlobalMapping during mesh/array setup.

Parameters
mpiMPI context.
myLengthNumber of rows owned by the calling rank.

Definition at line 72 of file IndexMapping.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

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