Public Member Functions | Public Attributes | Friends | List of all members
MLCommon::Matrix::PartDescriptor Struct Reference

#include <part_descriptor.hpp>

Collaboration diagram for MLCommon::Matrix::PartDescriptor:
Collaboration graph

Public Member Functions

 PartDescriptor (size_t _M, size_t _N, const std::vector< RankSizePair * > &_partsToRanks, int rank, Layout _layout=LayoutColMajor)
 For a given matrix and block-sizes construct the corresponding descriptor for it. This is useful when we are dealing with standard row/column-wise block-cyclic data distribution, as seen in other popular multi-node packages like magma etc. More...
 
int totalBlocks () const
 
int totalBlocksOwnedBy (int rank) const
 
std::set< int > uniqueRanks ()
 
std::vector< size_t > startIndices () const
 
std::vector< size_t > startIndices (int rank) const
 
std::vector< RankSizePair * > blocksOwnedBy (int rank) const
 Returns the vector of blocks (each identified by linearBLockIndex) owned by the given rank. More...
 
size_t totalElementsOwnedBy (int rank) const
 

Public Attributes

size_t M
 
size_t N
 
int rank
 
Layout layout
 
std::vector< RankSizePair * > partsToRanks
 

Friends

std::ostream & operator<< (std::ostream &os, const PartDescriptor &desc)
 
bool operator== (const PartDescriptor &a, const PartDescriptor &b)
 

Constructor & Destructor Documentation

◆ PartDescriptor()

MLCommon::Matrix::PartDescriptor::PartDescriptor ( size_t  _M,
size_t  _N,
const std::vector< RankSizePair * > &  _partsToRanks,
int  rank,
Layout  _layout = LayoutColMajor 
)

For a given matrix and block-sizes construct the corresponding descriptor for it. This is useful when we are dealing with standard row/column-wise block-cyclic data distribution, as seen in other popular multi-node packages like magma etc.

Parameters
_Mtotal number of rows of this matrix
_Ntotal number of columns
_partsToRanksmapping of ranks to parts and sizes
rankMPI rank of the process
_layoutdata layout (row or column major)

Member Function Documentation

◆ blocksOwnedBy()

std::vector<RankSizePair*> MLCommon::Matrix::PartDescriptor::blocksOwnedBy ( int  rank) const

Returns the vector of blocks (each identified by linearBLockIndex) owned by the given rank.

◆ startIndices() [1/2]

std::vector<size_t> MLCommon::Matrix::PartDescriptor::startIndices ( ) const

◆ startIndices() [2/2]

std::vector<size_t> MLCommon::Matrix::PartDescriptor::startIndices ( int  rank) const

◆ totalBlocks()

int MLCommon::Matrix::PartDescriptor::totalBlocks ( ) const
inline

total number of blocks across all workers

◆ totalBlocksOwnedBy()

int MLCommon::Matrix::PartDescriptor::totalBlocksOwnedBy ( int  rank) const

Count the total number of blocks owned by a given rank

◆ totalElementsOwnedBy()

size_t MLCommon::Matrix::PartDescriptor::totalElementsOwnedBy ( int  rank) const

Count the total number of matrix elements owned by a given rank

◆ uniqueRanks()

std::set<int> MLCommon::Matrix::PartDescriptor::uniqueRanks ( )

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const PartDescriptor desc 
)
friend

Print matrix descriptor in human readable form

◆ operator==

bool operator== ( const PartDescriptor a,
const PartDescriptor b 
)
friend

compare 2 descriptor objects

Member Data Documentation

◆ layout

Layout MLCommon::Matrix::PartDescriptor::layout

◆ M

size_t MLCommon::Matrix::PartDescriptor::M

total number of rows

◆ N

size_t MLCommon::Matrix::PartDescriptor::N

total number of columns

◆ partsToRanks

std::vector<RankSizePair*> MLCommon::Matrix::PartDescriptor::partsToRanks

mapping of each block (in col-major order) to the device that owns it

◆ rank

int MLCommon::Matrix::PartDescriptor::rank

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