SIRIUS 7.5.0
Electronic structure library and applications
Public Member Functions | Private Member Functions | Private Attributes | List of all members
sirius::mpi::Grid Class Reference

MPI grid interface. More...

#include <mpi_grid.hpp>

Public Member Functions

 Grid (std::vector< int > dimensions__, Communicator const &parent_communicator__)
 
int num_dimensions () const
 Actual number of grid dimensions. More...
 
auto const & communicator (int directions__=0xFF) const
 

Private Member Functions

int valid_directions (int directions__) const
 Return valid directions for the current grid dimensionality. More...
 
void initialize ()
 Initialize the grid. More...
 
 Grid (Grid const &src)=delete
 
Gridoperator= (Grid const &src)=delete
 

Private Attributes

std::vector< int > dimensions_
 Dimensions of the grid. More...
 
Communicator const & parent_communicator_
 Parent communicator. More...
 
Communicator base_grid_communicator_
 Grid communicator of the enrire grid returned by MPI_Cart_create. More...
 
std::vector< Communicatorcommunicators_
 Grid communicators. More...
 

Detailed Description

MPI grid interface.

The following terminology is used. Suppose we have a 4x5 grid of MPI ranks. We say it's a two-dimensional grid with the first dimension of the size 4 and the second dimensoion of the size 5. The actual number of grid dimensions is two, however we may also consider the grid as being a D-dimensional (D >= 2) with implicit dimension sizes equal to one, e.g. 4x5 := 4x5x1x1x1... The communication happens along single or multiple directions along the grid dimensions. We specify directions wth bits, eg. directions=00000101 reads as "communication along 1-st and 3-rd dimensions".

Communication along dimension d0 (between ranks of d0).

In the provided example the corresponding communicator is MPI_grid::communicator(1 << d0), where d0 is the integer index of dimension.

Definition at line 46 of file mpi_grid.hpp.

Constructor & Destructor Documentation

◆ Grid()

sirius::mpi::Grid::Grid ( std::vector< int >  dimensions__,
Communicator const &  parent_communicator__ 
)
inline

Definition at line 128 of file mpi_grid.hpp.

Member Function Documentation

◆ valid_directions()

int sirius::mpi::Grid::valid_directions ( int  directions__) const
inlineprivate

Return valid directions for the current grid dimensionality.

Definition at line 64 of file mpi_grid.hpp.

◆ initialize()

void sirius::mpi::Grid::initialize ( )
inlineprivate

Initialize the grid.

Definition at line 70 of file mpi_grid.hpp.

◆ num_dimensions()

int sirius::mpi::Grid::num_dimensions ( ) const
inline

Actual number of grid dimensions.

Definition at line 136 of file mpi_grid.hpp.

◆ communicator()

auto const & sirius::mpi::Grid::communicator ( int  directions__ = 0xFF) const
inline

Definition at line 141 of file mpi_grid.hpp.

Member Data Documentation

◆ dimensions_

std::vector<int> sirius::mpi::Grid::dimensions_
private

Dimensions of the grid.

Definition at line 50 of file mpi_grid.hpp.

◆ parent_communicator_

Communicator const& sirius::mpi::Grid::parent_communicator_
private

Parent communicator.

Definition at line 53 of file mpi_grid.hpp.

◆ base_grid_communicator_

Communicator sirius::mpi::Grid::base_grid_communicator_
private

Grid communicator of the enrire grid returned by MPI_Cart_create.

Definition at line 56 of file mpi_grid.hpp.

◆ communicators_

std::vector<Communicator> sirius::mpi::Grid::communicators_
private

Grid communicators.

Grid comminicators are built for all possible combinations of directions, i.e. 001, 010, 011, etc. First communicator is the trivial "self" communicator; the last communicator handles the entire grid.

Definition at line 61 of file mpi_grid.hpp.


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