MADNESS  0.10.1
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
madness::DistributedMatrixDistribution Class Reference

#include <distributed_matrix.h>

Inheritance diagram for madness::DistributedMatrixDistribution:
Inheritance graph
[legend]
Collaboration diagram for madness::DistributedMatrixDistribution:
Collaboration graph
[legend]

Public Member Functions

 DistributedMatrixDistribution ()
 Default constructor makes an invalid distribution. More...
 
virtual ~DistributedMatrixDistribution ()
 
void clear ()
 Resets state to same as default constructor. More...
 
int64_t coldim () const
 Returns the column dimension of the matrix ... i.e., n for A(n,m) More...
 
int64_t coltile () const
 Returns the column tile size. More...
 
const DistributedMatrixDistributiondistribution () const
 Returns the distribution (aka *this) More...
 
void get_colrange (int p, int64_t &ilow, int64_t &ihigh) const
 Returns the inclusive range of column indices on processor p. More...
 
void get_range (int p, int64_t &ilow, int64_t &ihigh, int64_t &jlow, int64_t &jhigh) const
 Returns the inclusive ranges of column and row indicies on processor p. More...
 
void get_rowrange (int p, int64_t &jlow, int64_t &jhigh) const
 Returns the inclusive range of row indices on processor p. More...
 
Worldget_world () const
 Returns the associated world. More...
 
bool is_column_distributed () const
 Returns true if the matrix is column distributed (i.e., row dimension not distributed) More...
 
bool is_row_distributed () const
 Returns true if the matrix is row distributed (i.e., column dimension not distributed) More...
 
int64_t local_coldim () const
 Returns the no. of column elements stored on this processor. More...
 
void local_colrange (int64_t &ilow, int64_t &ihigh) const
 Returns the inclusive range of column indices on this processor. More...
 
int64_t local_ihigh () const
 Returns the last column index on this processor (-1 if no data present) More...
 
int64_t local_ilow () const
 Returns the first column index on this processor (0 if no data present) More...
 
int64_t local_jhigh () const
 Returns the last row index on this processor (0 if no data present) More...
 
int64_t local_jlow () const
 Returns the first row index on this processor (0 if no data present) More...
 
int64_t local_rowdim () const
 Returns the no. of row elements stored on this processor. More...
 
void local_rowrange (int64_t &jlow, int64_t &jhigh) const
 Returns the inclusive range of row indices on this processor. More...
 
int64_t local_size () const
 Returns the total no. of elements stored on this processor. More...
 
bool operator== (const DistributedMatrixDistribution &d) const
 
ProcessID owner (int64_t i, int64_t j) const
 Returns the number of the process that owns element (i,j) More...
 
int64_t process_coldim () const
 Returns the no. of processors in the column dimension. More...
 
int64_t process_rowdim () const
 Returns the no. of processors in the row dimension. More...
 
int64_t rowdim () const
 Returns the row dimension of the matrix ... i.e., m for A(n,m) More...
 
int64_t rowtile () const
 Returns the row tile size. More...
 

Protected Member Functions

 DistributedMatrixDistribution (World &world, int64_t n, int64_t m, int64_t coltile, int64_t rowtile)
 Constructs distribution and size info for a matrix (for use by factory functions only) More...
 

Protected Attributes

int64_t idim
 
int64_t ihi
 Range of column indices on this processor. More...
 
int64_t ilo
 
int64_t jdim
 Dimension of data on this processor. More...
 
int64_t jhi
 Range of row indices on this processor. More...
 
int64_t jlo
 
int64_t m
 Row dimension of A(n,m) More...
 
int64_t n
 Column dimension of A(n,m) More...
 
int64_t P
 No. of processors. More...
 
int64_t Pcol
 Column of processor grid for this processor. More...
 
int64_t Pcoldim
 Column dimension of processor grid. More...
 
int64_t Prow
 Row of processor grid for this processor. More...
 
int64_t Prowdim
 Row dimension of processor grid. More...
 
Worldpworld
 
ProcessID rank
 My processor rank. More...
 
int64_t tilem
 Tile size for row. More...
 
int64_t tilen
 Tile size for column. More...
 

Friends

DistributedMatrixDistribution column_distributed_matrix_distribution (World &world, int64_t n, int64_t m, int64_t coltile)
 Generates distribution for an (n,m) matrix distributed by columns (row dimension is not distributed) More...
 
template<typename T >
class DistributedMatrix
 
DistributedMatrixDistribution row_distributed_matrix_distribution (World &world, int64_t n, int64_t m, int64_t rowtile)
 Generates an (n,m) matrix distribution distributed by rows (column dimension is not distributed) More...
 

Constructor & Destructor Documentation

◆ DistributedMatrixDistribution() [1/2]

madness::DistributedMatrixDistribution::DistributedMatrixDistribution ( World world,
int64_t  n,
int64_t  m,
int64_t  coltile,
int64_t  rowtile 
)
inlineprotected

Constructs distribution and size info for a matrix (for use by factory functions only)

This routine is dumb and just copies the given arguments, hence it can easily make an invalid matrix. The smarts are in the factory functions, hence this constructor is not for general use.

The matrix is tiled over a grid of processes as specified by the tile sizes.

Parameters
[in]worldThe world
[in]nThe matrix column dimension
[in]mThe matrix row dimension
[in]coltileTile size for the columns
[in]rowtileTile size for the rows

References ihi, ilo, jhi, and jlo.

◆ DistributedMatrixDistribution() [2/2]

madness::DistributedMatrixDistribution::DistributedMatrixDistribution ( )
inline

Default constructor makes an invalid distribution.

◆ ~DistributedMatrixDistribution()

virtual madness::DistributedMatrixDistribution::~DistributedMatrixDistribution ( )
inlinevirtual

Member Function Documentation

◆ clear()

void madness::DistributedMatrixDistribution::clear ( )
inline

Resets state to same as default constructor.

References idim, ihi, ilo, jdim, jhi, jlo, m, n, P, Pcol, Pcoldim, Prow, Prowdim, pworld, rank, tilem, and tilen.

Referenced by madness::DistributedMatrix< T >::clear().

◆ coldim()

int64_t madness::DistributedMatrixDistribution::coldim ( ) const
inline

Returns the column dimension of the matrix ... i.e., n for A(n,m)

Returns
Column dimension of the matrix ... i.e., n for A(n,m)

References n.

Referenced by madness::DistributedMatrix< T >::extract_columns().

◆ coltile()

int64_t madness::DistributedMatrixDistribution::coltile ( ) const
inline

Returns the column tile size.

Returns
Column tile size

References tilen.

Referenced by madness::DistributedMatrix< T >::extract_columns(), and owner().

◆ distribution()

const DistributedMatrixDistribution& madness::DistributedMatrixDistribution::distribution ( ) const
inline

Returns the distribution (aka *this)

Referenced by madness::SCF::kinetic_energy_matrix(), and madness::Kinetic< T, NDIM >::kinetic_energy_matrix().

◆ get_colrange()

void madness::DistributedMatrixDistribution::get_colrange ( int  p,
int64_t &  ilow,
int64_t &  ihigh 
) const
inline

Returns the inclusive range of column indices on processor p.

If is no data on processor p it returns ilow=0 and ihigh=-1

Parameters
[in]pThe processor p of interest
[out]ilowThe first column index on the processor
[out]ihighThe last column index on the processor (-1 if none)

References get_range(), and p().

◆ get_range()

void madness::DistributedMatrixDistribution::get_range ( int  p,
int64_t &  ilow,
int64_t &  ihigh,
int64_t &  jlow,
int64_t &  jhigh 
) const
inline

Returns the inclusive ranges of column and row indicies on processor p.

If is no data on processor p it returns ilow=jlow=0 and ihigh=jhigh=-1

Parameters
[in]pThe processor p of interest
[out]ilowThe first column index on the processor
[out]ihighThe last column index on the processor (-1 if none)
[out]jlowThe first row index on the processor
[out]jhighThe last row index on the processor (-1 if none)

References m, n, p(), pi, process_coldim(), process_rowdim(), Prowdim, tilem, and tilen.

Referenced by get_colrange(), and get_rowrange().

◆ get_rowrange()

void madness::DistributedMatrixDistribution::get_rowrange ( int  p,
int64_t &  jlow,
int64_t &  jhigh 
) const
inline

Returns the inclusive range of row indices on processor p.

If is no data on processor p it returns jlow=0 and jhigh=-1

Parameters
[in]pThe processor p of interest
[out]jlowThe first row index on the processor
[out]jhighThe last row index on the processor (-1 if none)

References get_range(), and p().

◆ get_world()

World& madness::DistributedMatrixDistribution::get_world ( ) const
inline

Returns the associated world.

Returns
The world

References pworld.

Referenced by madness::DistributedMatrix< T >::copy_to_replicated(), and madness::DistributedMatrix< T >::copy_to_replicated_patch().

◆ is_column_distributed()

bool madness::DistributedMatrixDistribution::is_column_distributed ( ) const
inline

Returns true if the matrix is column distributed (i.e., row dimension not distributed)

Returns
True if the matrix is column distributed (i.e., row dimension not distributed)

References process_rowdim().

Referenced by madness::DistributedMatrix< T >::extract_columns().

◆ is_row_distributed()

bool madness::DistributedMatrixDistribution::is_row_distributed ( ) const
inline

Returns true if the matrix is row distributed (i.e., column dimension not distributed)

Returns
True if the matrix is row distributed (i.e., column dimension not distributed)

References process_coldim().

◆ local_coldim()

int64_t madness::DistributedMatrixDistribution::local_coldim ( ) const
inline

Returns the no. of column elements stored on this processor.

Returns
No. of column elements stored on this processor (may be zero)

References idim.

◆ local_colrange()

void madness::DistributedMatrixDistribution::local_colrange ( int64_t &  ilow,
int64_t &  ihigh 
) const
inline

Returns the inclusive range of column indices on this processor.

If there is no data on this processor it returns ilow=0 and ihigh=-1

Parameters
[out]ilowFirst column index on this processor (0 if no data)
[out]ihighLast column index on this processor (-1 if no data)

References ihi, and ilo.

◆ local_ihigh()

int64_t madness::DistributedMatrixDistribution::local_ihigh ( ) const
inline

Returns the last column index on this processor (-1 if no data present)

References ihi.

◆ local_ilow()

int64_t madness::DistributedMatrixDistribution::local_ilow ( ) const
inline

Returns the first column index on this processor (0 if no data present)

References ilo.

◆ local_jhigh()

int64_t madness::DistributedMatrixDistribution::local_jhigh ( ) const
inline

Returns the last row index on this processor (0 if no data present)

References jhi.

◆ local_jlow()

int64_t madness::DistributedMatrixDistribution::local_jlow ( ) const
inline

Returns the first row index on this processor (0 if no data present)

References jlo.

◆ local_rowdim()

int64_t madness::DistributedMatrixDistribution::local_rowdim ( ) const
inline

Returns the no. of row elements stored on this processor.

Returns
No. of row elements stored on this processor

References jdim.

◆ local_rowrange()

void madness::DistributedMatrixDistribution::local_rowrange ( int64_t &  jlow,
int64_t &  jhigh 
) const
inline

Returns the inclusive range of row indices on this processor.

If there is no data on this processor it returns jlow=0 and jhigh=-1

Parameters
[out]jlowFirst row index on this processor (0 if no data)
[out]jhighLast row index on this processor (-1 if no data)

References jhi, and jlo.

◆ local_size()

int64_t madness::DistributedMatrixDistribution::local_size ( ) const
inline

Returns the total no. of elements stored on this processor.

Returns
Total no. of elements stored on this processor

References idim, and jdim.

Referenced by madness::DistributedMatrix< T >::copy_from_replicated(), and madness::DistributedMatrix< T >::copy_to_replicated().

◆ operator==()

bool madness::DistributedMatrixDistribution::operator== ( const DistributedMatrixDistribution d) const
inline

◆ owner()

ProcessID madness::DistributedMatrixDistribution::owner ( int64_t  i,
int64_t  j 
) const
inline

Returns the number of the process that owns element (i,j)

References coltile(), process_rowdim(), and rowtile().

◆ process_coldim()

int64_t madness::DistributedMatrixDistribution::process_coldim ( ) const
inline

Returns the no. of processors in the column dimension.

Returns
No. of processors in the column dimension

References Pcoldim.

Referenced by get_range(), and is_row_distributed().

◆ process_rowdim()

int64_t madness::DistributedMatrixDistribution::process_rowdim ( ) const
inline

Returns the no. of processors in the row dimension.

Returns
No. of processors in the rown dimension

References Prowdim.

Referenced by get_range(), is_column_distributed(), and owner().

◆ rowdim()

int64_t madness::DistributedMatrixDistribution::rowdim ( ) const
inline

Returns the row dimension of the matrix ... i.e., m for A(n,m)

Returns
Row dimension of the matrix ... i.e., m for A(n,m)

References m.

Referenced by madness::DistributedMatrix< T >::extract_columns().

◆ rowtile()

int64_t madness::DistributedMatrixDistribution::rowtile ( ) const
inline

Returns the row tile size.

Returns
Row tile size

References tilem.

Referenced by owner().

Friends And Related Function Documentation

◆ column_distributed_matrix_distribution

DistributedMatrixDistribution column_distributed_matrix_distribution ( World world,
int64_t  n,
int64_t  m,
int64_t  coltile 
)
friend

Generates distribution for an (n,m) matrix distributed by columns (row dimension is not distributed)

Quietly forces an even column tile size for ease of use in the systolic matrix algorithms

Parameters
[in]worldThe world
[in]nThe column (first) dimension
[in]mThe row (second) dimension
[in]coltileTile size for columns forced to be even (default is to use all processes)
Returns
An object encoding the dimension and distribution information

◆ DistributedMatrix

template<typename T >
friend class DistributedMatrix
friend

◆ row_distributed_matrix_distribution

DistributedMatrixDistribution row_distributed_matrix_distribution ( World world,
int64_t  n,
int64_t  m,
int64_t  rowtile 
)
friend

Generates an (n,m) matrix distribution distributed by rows (column dimension is not distributed)

Parameters
[in]worldThe world
[in]nThe column (first) dimension
[in]mThe row (second) dimension
[in]rowtileTile size for row (default is to use all processes)
Returns
An object encoding the dimension and distribution information

Member Data Documentation

◆ idim

int64_t madness::DistributedMatrixDistribution::idim
protected

◆ ihi

int64_t madness::DistributedMatrixDistribution::ihi
protected

◆ ilo

int64_t madness::DistributedMatrixDistribution::ilo
protected

◆ jdim

int64_t madness::DistributedMatrixDistribution::jdim
protected

Dimension of data on this processor.

Referenced by madness::DistributedMatrix< T >::DistributedMatrix(), clear(), local_rowdim(), local_size(), and operator==().

◆ jhi

int64_t madness::DistributedMatrixDistribution::jhi
protected

◆ jlo

int64_t madness::DistributedMatrixDistribution::jlo
protected

◆ m

int64_t madness::DistributedMatrixDistribution::m
protected

Row dimension of A(n,m)

Referenced by clear(), get_range(), operator==(), and rowdim().

◆ n

int64_t madness::DistributedMatrixDistribution::n
protected

Column dimension of A(n,m)

Referenced by clear(), coldim(), get_range(), and operator==().

◆ P

int64_t madness::DistributedMatrixDistribution::P
protected

No. of processors.

Referenced by clear(), and operator==().

◆ Pcol

int64_t madness::DistributedMatrixDistribution::Pcol
protected

Column of processor grid for this processor.

Referenced by clear(), and operator==().

◆ Pcoldim

int64_t madness::DistributedMatrixDistribution::Pcoldim
protected

Column dimension of processor grid.

Referenced by clear(), operator==(), and process_coldim().

◆ Prow

int64_t madness::DistributedMatrixDistribution::Prow
protected

Row of processor grid for this processor.

Referenced by clear(), and operator==().

◆ Prowdim

int64_t madness::DistributedMatrixDistribution::Prowdim
protected

Row dimension of processor grid.

Referenced by clear(), get_range(), operator==(), and process_rowdim().

◆ pworld

World* madness::DistributedMatrixDistribution::pworld
protected

Referenced by clear(), get_world(), and operator==().

◆ rank

ProcessID madness::DistributedMatrixDistribution::rank
protected

My processor rank.

Referenced by clear(), and operator==().

◆ tilem

int64_t madness::DistributedMatrixDistribution::tilem
protected

Tile size for row.

Referenced by clear(), get_range(), operator==(), and rowtile().

◆ tilen

int64_t madness::DistributedMatrixDistribution::tilen
protected

Tile size for column.

Referenced by clear(), coltile(), get_range(), and operator==().


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