DFT-EFE
 
Loading...
Searching...
No Matches
dftefe::linearAlgebra::ProcessGrid Class Reference

#include <ProcessGrid.h>

Public Member Functions

 ProcessGrid (const utils::mpi::MPIComm &mpi_communicator, const unsigned int n_rows, const unsigned int n_columns)
 
 ProcessGrid (const utils::mpi::MPIComm &mpi_communicator, const unsigned int n_rows_matrix, const unsigned int n_columns_matrix, const unsigned int row_block_size, const unsigned int column_block_size)
 
 ~ProcessGrid ()
 
const int & get_blacs_context () const
 
const int & get_process_grid_rows () const
 
const int & get_process_grid_columns () const
 
const int & get_this_process_row () const
 
const int & get_this_process_column () const
 
template<typename NumberType >
void send_to_inactive (NumberType *value, const int count=1) const
 
const bool & is_process_active () const
 
const utils::mpi::MPICommget_mpi_communicator () const
 

Private Member Functions

 ProcessGrid (const utils::mpi::MPIComm &mpi_communicator, const std::pair< unsigned int, unsigned int > &grid_dimensions)
 

Private Attributes

utils::mpi::MPIComm mpi_communicator
 
utils::mpi::MPIComm mpi_communicator_inactive_with_root
 
int blacs_context
 
const unsigned int this_mpi_process
 
const unsigned int n_mpi_processes
 
int n_process_rows
 
int n_process_columns
 
int this_process_row
 
int this_process_column
 
bool mpi_process_is_active
 

Detailed Description

A class taking care of setting up a two-dimensional processor grid. For example an MPI communicator with 5 processes can be arranged into a 2x2 grid with the 5-th processor being inactive:

| 0 | 1
-----| ------- |-----
0 | P0 | P1
| |
-----| ------- |-----
1 | P2 | P3

A shared pointer to this class is provided to ScaLAPACKMatrix matrices to perform block-cyclic distribution.

Note that this class allows to setup a process grid which has fewer MPI cores than the total number of cores in the communicator.

Currently the only place where one would use a ProcessGrid object is in connection with a ScaLAPACKMatrix object.

Constructor & Destructor Documentation

◆ ProcessGrid() [1/3]

dftefe::linearAlgebra::ProcessGrid::ProcessGrid ( const utils::mpi::MPIComm mpi_communicator,
const unsigned int  n_rows,
const unsigned int  n_columns 
)

Constructor for a process grid with n_rows and n_columns for a given mpi_communicator. The product of rows and columns should be less or equal to the total number of cores in the mpi_communicator.

◆ ProcessGrid() [2/3]

dftefe::linearAlgebra::ProcessGrid::ProcessGrid ( const utils::mpi::MPIComm mpi_communicator,
const unsigned int  n_rows_matrix,
const unsigned int  n_columns_matrix,
const unsigned int  row_block_size,
const unsigned int  column_block_size 
)

$, where $M,N$ are the matrix dimension and $MB,NB$ are the block sizes and $Np$ is the number of processes in the mpi_communicator. This function then creates a 2D processor grid assuming the ratio between number of process row $p$ and columns $q$ to be equal the ratio between matrix dimensions $M$ and $N$.

For example, a square matrix $640x640$ with the block size $32$ and the mpi_communicator with 11 cores will result in the $3x3$ process grid.

◆ ~ProcessGrid()

dftefe::linearAlgebra::ProcessGrid::~ProcessGrid ( )

Destructor.

Here is the call graph for this function:

◆ ProcessGrid() [3/3]

dftefe::linearAlgebra::ProcessGrid::ProcessGrid ( const utils::mpi::MPIComm mpi_communicator,
const std::pair< unsigned int, unsigned int > &  grid_dimensions 
)
private

A private constructor which takes grid dimensions as an std::pair.

Here is the call graph for this function:

Member Function Documentation

◆ get_blacs_context()

const int & dftefe::linearAlgebra::ProcessGrid::get_blacs_context ( ) const
inline

Return the blacs_context.

◆ get_mpi_communicator()

const utils::mpi::MPIComm & dftefe::linearAlgebra::ProcessGrid::get_mpi_communicator ( ) const
inline

◆ get_process_grid_columns()

const int & dftefe::linearAlgebra::ProcessGrid::get_process_grid_columns ( ) const
inline

Return the number of columns in the processes grid.

◆ get_process_grid_rows()

const int & dftefe::linearAlgebra::ProcessGrid::get_process_grid_rows ( ) const
inline

Return the number of rows in the processes grid.

◆ get_this_process_column()

const int & dftefe::linearAlgebra::ProcessGrid::get_this_process_column ( ) const
inline

Return column of this process in the process grid.

It's negative for inactive processes.

◆ get_this_process_row()

const int & dftefe::linearAlgebra::ProcessGrid::get_this_process_row ( ) const
inline

Return row of this process in the process grid.

It's negative for inactive processes.

◆ is_process_active()

const bool & dftefe::linearAlgebra::ProcessGrid::is_process_active ( ) const
inline

Return true if the process is active within the grid.

◆ send_to_inactive()

template<typename NumberType >
template void dftefe::linearAlgebra::ProcessGrid::send_to_inactive< int > ( NumberType *  value,
const int  count = 1 
) const

Send count values stored consequently starting at value from the process with rank zero to processes which are not in the process grid.

Here is the call graph for this function:

Member Data Documentation

◆ blacs_context

int dftefe::linearAlgebra::ProcessGrid::blacs_context
private

BLACS context. This is equivalent to MPI communicators and is used by ScaLAPACK.

◆ mpi_communicator

utils::mpi::MPIComm dftefe::linearAlgebra::ProcessGrid::mpi_communicator
private

An MPI communicator with all processes (active and inactive).

◆ mpi_communicator_inactive_with_root

utils::mpi::MPIComm dftefe::linearAlgebra::ProcessGrid::mpi_communicator_inactive_with_root
private

An MPI communicator with inactive processes and the process with rank zero.

◆ mpi_process_is_active

bool dftefe::linearAlgebra::ProcessGrid::mpi_process_is_active
private

A flag which is true for processes within the 2D process grid.

◆ n_mpi_processes

const unsigned int dftefe::linearAlgebra::ProcessGrid::n_mpi_processes
private

Total number of MPI processes.

◆ n_process_columns

int dftefe::linearAlgebra::ProcessGrid::n_process_columns
private

Number of columns in the processes grid.

◆ n_process_rows

int dftefe::linearAlgebra::ProcessGrid::n_process_rows
private

Number of rows in the processes grid.

◆ this_mpi_process

const unsigned int dftefe::linearAlgebra::ProcessGrid::this_mpi_process
private

Rank of this MPI process.

◆ this_process_column

int dftefe::linearAlgebra::ProcessGrid::this_process_column
private

Column of this process in the grid.

It's negative for in-active processes.

◆ this_process_row

int dftefe::linearAlgebra::ProcessGrid::this_process_row
private

Row of this process in the grid.

It's negative for in-active processes.


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