Documentation 6b54b78464
Loading...
Searching...
No Matches
CLinearPartitioner Class Reference

Helper class that provides the counts for each rank in a linear partitioning given the global count as input. More...

#include <CLinearPartitioner.hpp>

Public Member Functions

 CLinearPartitioner ()=default
 
 CLinearPartitioner (unsigned long global_count, unsigned long offset, bool isDisjoint=false)
 Constructor of the CLinearPartitioner class, see Initialize.
 
void Initialize (unsigned long global_count, unsigned long offset, bool isDisjoint=false)
 Initialize the CLinearPartitioner class.
 
unsigned long GetRankContainingIndex (unsigned long index) const
 Get the rank that owns the index based on the linear partitioning.
 
unsigned long GetFirstIndexOnRank (int rank) const
 Get the first index of the current rank's linear partition.
 
unsigned long GetLastIndexOnRank (int rank) const
 Get the last index of the current rank's linear partition.
 
unsigned long GetSizeOnRank (int rank) const
 Get the total size of the current rank's linear partition.
 
unsigned long GetCumulativeSizeBeforeRank (int rank) const
 Get the cumulative size of all linear partitions before the current rank.
 
bool IndexBelongsToRank (unsigned long index, int rank) const
 Checks if an index belongs to a rank.
 

Protected Attributes

int size
 MPI Size.
 
vector< unsigned long > firstIndex
 Vector containing the first index on each rank due to a linear partitioning by global count.
 
vector< unsigned long > lastIndex
 Vector containing the last index on each rank due to a linear partitioning by global count.
 
vector< unsigned long > sizeOnRank
 Vector containing the total size of the current rank's linear partition.
 
vector< unsigned long > cumulativeSizeBeforeRank
 Vector containing the cumulative size of all linear partitions before the current rank.
 

Detailed Description

Helper class that provides the counts for each rank in a linear partitioning given the global count as input.

Author
T. Economon

Constructor & Destructor Documentation

◆ CLinearPartitioner() [1/2]

CLinearPartitioner::CLinearPartitioner ( )
default

◆ CLinearPartitioner() [2/2]

CLinearPartitioner::CLinearPartitioner ( unsigned long  global_count,
unsigned long  offset,
bool  isDisjoint = false 
)
inline

Constructor of the CLinearPartitioner class, see Initialize.

Member Function Documentation

◆ GetCumulativeSizeBeforeRank()

unsigned long CLinearPartitioner::GetCumulativeSizeBeforeRank ( int  rank) const
inline

Get the cumulative size of all linear partitions before the current rank.

Parameters
[in]rank- MPI rank identifier.
Returns
Cumulative size of all linear partitions before the current rank.

◆ GetFirstIndexOnRank()

unsigned long CLinearPartitioner::GetFirstIndexOnRank ( int  rank) const
inline

Get the first index of the current rank's linear partition.

Parameters
[in]rank- MPI rank identifier.
Returns
First index of the current rank's linear partition.

◆ GetLastIndexOnRank()

unsigned long CLinearPartitioner::GetLastIndexOnRank ( int  rank) const
inline

Get the last index of the current rank's linear partition.

Parameters
[in]rank- MPI rank identifier.
Returns
Last index of the current rank's linear partition.

◆ GetRankContainingIndex()

unsigned long CLinearPartitioner::GetRankContainingIndex ( unsigned long  index) const

Get the rank that owns the index based on the linear partitioning.

Parameters
[in]index- Current index.
Returns
Owning rank for the current index based on linear partitioning.

◆ GetSizeOnRank()

unsigned long CLinearPartitioner::GetSizeOnRank ( int  rank) const
inline

Get the total size of the current rank's linear partition.

Parameters
[in]rank- MPI rank identifier.
Returns
Size of the current rank's linear partition.

◆ IndexBelongsToRank()

bool CLinearPartitioner::IndexBelongsToRank ( unsigned long  index,
int  rank 
) const
inline

Checks if an index belongs to a rank.

Parameters
[in]index- Current index.
[in]rank- MPI rank identifier.
Returns
True if index is owned by rank.

◆ Initialize()

void CLinearPartitioner::Initialize ( unsigned long  global_count,
unsigned long  offset,
bool  isDisjoint = false 
)

Initialize the CLinearPartitioner class.

Parameters
[in]global_count- global count to be linearly partitioned.
[in]offset- offset from 0 for the first index on rank 0 (typically 0).
[in]isDisjoint- boolean controlling whether the linear partitions should be disjoint (default is false).

Member Data Documentation

◆ cumulativeSizeBeforeRank

vector<unsigned long> CLinearPartitioner::cumulativeSizeBeforeRank
protected

Vector containing the cumulative size of all linear partitions before the current rank.

◆ firstIndex

vector<unsigned long> CLinearPartitioner::firstIndex
protected

Vector containing the first index on each rank due to a linear partitioning by global count.

◆ lastIndex

vector<unsigned long> CLinearPartitioner::lastIndex
protected

Vector containing the last index on each rank due to a linear partitioning by global count.

◆ size

int CLinearPartitioner::size
protected

MPI Size.

◆ sizeOnRank

vector<unsigned long> CLinearPartitioner::sizeOnRank
protected

Vector containing the total size of the current rank's linear partition.


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