TiledArray::detail::ProcGrid Class Reference

Documentation

A 2D processor grid.

ProcGrid attempts to create a near optimal 2D grid of P processes for an MxN grid of tiles. The size of the grid is optimized such that the total communication time required for SUMMA and the number of unused processes is minimized. The total communication time of SUMMA is given by:

\[ T = \frac{MK}{P_{\rm{row}}} \left(\alpha + \frac{mk}{\beta}\right) \left((P/P_{\rm{row}}) - 1\right) + \frac{KN}{P/P_{\rm{row}}} \left(\alpha + \frac{kn}{\beta}\right) \left(P_{\rm{row}} - 1\right) \]

where $P_{\rm{row}}$ is the number of process rows; $M$, $N$, and $K$ are the number of tile rows and columns in a matrix product with average tiles sizes of $m$, $n$, and $k$, respectively; $P$ is the number or available processes; $\alpha$ is the message latency; and $\beta$ is the message data rate. If we evaluate $dT/dP_{\rm{row}} = 0$ and assume that $\alpha \approx 0$, the expression simplifies to:

\[ Nn(2 P_{\rm{row}}^4 - P_{\rm{row}}^3) + Mm(P P_{\rm{row}} - P^2) = 0 \]

where the positive, real root of $P_{\rm{row}}$ give the optimal optimal communication time.

Definition at line 58 of file proc_grid.h.

Public Types

typedef uint_fast32_t size_type
 

Public Member Functions

 ProcGrid ()
 Default constructor. More...
 
 ProcGrid (World &world, const size_type rows, const size_type cols, const std::size_t row_size, const std::size_t col_size)
 Construct a process grid. More...
 
 ProcGrid (const ProcGrid &other)
 Copy constructor. More...
 
ProcGridoperator= (const ProcGrid &other)
 Copy assignment operator. More...
 
size_type rows () const
 Element row count accessor. More...
 
size_type cols () const
 Element column count accessor. More...
 
size_type size () const
 Element count accessor. More...
 
size_type local_rows () const
 Local element row count accessor. More...
 
size_type local_cols () const
 Local element column count accessor. More...
 
size_type local_size () const
 Local element count accessor. More...
 
ProcessID rank_row () const
 Rank row accessor. More...
 
ProcessID rank_col () const
 Rank row accessor. More...
 
size_type proc_rows () const
 Process row count accessor. More...
 
size_type proc_cols () const
 Process column count accessor. More...
 
size_type proc_size () const
 Process grid size accessor. More...
 
madness::Group make_row_group (const madness::DistributedID &did) const
 Construct a row group. More...
 
madness::Group make_col_group (const madness::DistributedID &did) const
 Construct a column group. More...
 
ProcessID map_row (const size_type row) const
 Map a row to the process in this process's column. More...
 
ProcessID map_col (const size_type col) const
 Map a column to the process in this process's row. More...
 
std::shared_ptr< Pmapmake_pmap () const
 Construct a cyclic process. More...
 
std::shared_ptr< Pmapmake_col_phase_pmap (const size_type rows) const
 Construct column phased a cyclic process. More...
 
std::shared_ptr< Pmapmake_row_phase_pmap (const size_type cols) const
 Construct row phased a cyclic process. More...
 

Member Typedef Documentation

◆ size_type

Definition at line 60 of file proc_grid.h.

Constructor & Destructor Documentation

◆ ProcGrid() [1/3]

TiledArray::detail::ProcGrid::ProcGrid ( )
inline

Default constructor.

All sizes are initialized to zero.

Definition at line 253 of file proc_grid.h.

◆ ProcGrid() [2/3]

TiledArray::detail::ProcGrid::ProcGrid ( World &  world,
const size_type  rows,
const size_type  cols,
const std::size_t  row_size,
const std::size_t  col_size 
)
inline

Construct a process grid.

Parameters
worldThe world where the process grid will live
rowsThe number of tile rows
colsThe number of tile columns
row_sizeThe number of element rows
col_sizeThe number of element columns

Definition at line 277 of file proc_grid.h.

◆ ProcGrid() [3/3]

TiledArray::detail::ProcGrid::ProcGrid ( const ProcGrid other)
inline

Copy constructor.

Parameters
otherThe other process grid to be copied

Definition at line 349 of file proc_grid.h.

Member Function Documentation

◆ cols()

size_type TiledArray::detail::ProcGrid::cols ( ) const
inline

Element column count accessor.

Returns
The number of element columns

Definition at line 391 of file proc_grid.h.

Here is the caller graph for this function:

◆ local_cols()

size_type TiledArray::detail::ProcGrid::local_cols ( ) const
inline

Local element column count accessor.

Returns
The number of element columns

Definition at line 406 of file proc_grid.h.

◆ local_rows()

size_type TiledArray::detail::ProcGrid::local_rows ( ) const
inline

Local element row count accessor.

Returns
The number of element rows

Definition at line 401 of file proc_grid.h.

◆ local_size()

size_type TiledArray::detail::ProcGrid::local_size ( ) const
inline

Local element count accessor.

Returns
The number of elements assigned to this process

Definition at line 411 of file proc_grid.h.

◆ make_col_group()

madness::Group TiledArray::detail::ProcGrid::make_col_group ( const madness::DistributedID &  did) const
inline

Construct a column group.

Parameters
didThe distributed id for the result group
Returns
A Group object that includes all processes in rank_col

Definition at line 469 of file proc_grid.h.

◆ make_col_phase_pmap()

std::shared_ptr<Pmap> TiledArray::detail::ProcGrid::make_col_phase_pmap ( const size_type  rows) const
inline

Construct column phased a cyclic process.

Construct a cyclic process map where the column phase of the process matches that of this process grid.

Parameters
rowsThe number of rows in the process map
Returns
Cyclic process map with matching column phase

Definition at line 528 of file proc_grid.h.

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

◆ make_pmap()

std::shared_ptr<Pmap> TiledArray::detail::ProcGrid::make_pmap ( ) const
inline

Construct a cyclic process.

Construct a cyclic process map with the same phase as the process grid.

Returns
Cyclic process map

Definition at line 515 of file proc_grid.h.

Here is the caller graph for this function:

◆ make_row_group()

madness::Group TiledArray::detail::ProcGrid::make_row_group ( const madness::DistributedID &  did) const
inline

Construct a row group.

Parameters
didThe distributed id for the result group
Returns
A Group object that includes all processes in rank_row

Definition at line 443 of file proc_grid.h.

◆ make_row_phase_pmap()

std::shared_ptr<Pmap> TiledArray::detail::ProcGrid::make_row_phase_pmap ( const size_type  cols) const
inline

Construct row phased a cyclic process.

Construct a cyclic process map where the column phase of the process matches that of this process grid.

Parameters
colsThe number of columns in the process map
Returns
Cyclic process map with matching column phase

Definition at line 541 of file proc_grid.h.

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

◆ map_col()

ProcessID TiledArray::detail::ProcGrid::map_col ( const size_type  col) const
inline

Map a column to the process in this process's row.

Parameters
colThe column to be mapped
Returns
The process the corresponds to the process coordinate (rank_row,col)

Definition at line 506 of file proc_grid.h.

◆ map_row()

ProcessID TiledArray::detail::ProcGrid::map_row ( const size_type  row) const
inline

Map a row to the process in this process's column.

Parameters
rowThe row to be mapped
Returns
The process the corresponds to the process coordinate (row,rank_col)

Definition at line 496 of file proc_grid.h.

◆ operator=()

ProcGrid& TiledArray::detail::ProcGrid::operator= ( const ProcGrid other)
inline

Copy assignment operator.

Parameters
otherThe other process grid to be copied

Definition at line 366 of file proc_grid.h.

◆ proc_cols()

size_type TiledArray::detail::ProcGrid::proc_cols ( ) const
inline

Process column count accessor.

Returns
The number of columns in the process grid

Definition at line 431 of file proc_grid.h.

Here is the caller graph for this function:

◆ proc_rows()

size_type TiledArray::detail::ProcGrid::proc_rows ( ) const
inline

Process row count accessor.

Returns
The number of rows in the process grid

Definition at line 426 of file proc_grid.h.

Here is the caller graph for this function:

◆ proc_size()

size_type TiledArray::detail::ProcGrid::proc_size ( ) const
inline

Process grid size accessor.

Returns
The number of processes included in the process grid (may be less than the number of process in world).

Definition at line 437 of file proc_grid.h.

◆ rank_col()

ProcessID TiledArray::detail::ProcGrid::rank_col ( ) const
inline

Rank row accessor.

Returns
The column of this process in the process grid

Definition at line 421 of file proc_grid.h.

◆ rank_row()

ProcessID TiledArray::detail::ProcGrid::rank_row ( ) const
inline

Rank row accessor.

Returns
The row of this process in the process grid

Definition at line 416 of file proc_grid.h.

◆ rows()

size_type TiledArray::detail::ProcGrid::rows ( ) const
inline

Element row count accessor.

Returns
The number of element rows

Definition at line 386 of file proc_grid.h.

Here is the caller graph for this function:

◆ size()

size_type TiledArray::detail::ProcGrid::size ( ) const
inline

Element count accessor.

Returns
The total number of elements

Definition at line 396 of file proc_grid.h.


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