DFT-FE 1.1.0-pre
Density Functional Theory With Finite-Elements
Loading...
Searching...
No Matches
dftfe::ProcessGrid Class Reference

#include <process_grid.h>

Public Member Functions

 ProcessGrid (const MPI_Comm &mpi_communicator, const unsigned int n_rows, const unsigned int n_columns)
 
 ProcessGrid (const MPI_Comm &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 ()
 
int get_blacs_context () const
 
unsigned int get_process_grid_rows () const
 
unsigned int get_process_grid_columns () const
 
int get_this_process_row () const
 
int get_this_process_column () const
 
template<typename NumberType>
void send_to_inactive (NumberType *value, const int count=1) const
 
bool is_process_active () const
 

Private Member Functions

 ProcessGrid (const MPI_Comm &mpi_communicator, const std::pair< unsigned int, unsigned int > &grid_dimensions)
 

Private Attributes

MPI_Comm mpi_communicator
 
MPI_Comm 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
 

Friends

template<typename NumberType>
class dftfe::ScaLAPACKMatrix
 

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]

dftfe::ProcessGrid::ProcessGrid ( const MPI_Comm & 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]

dftfe::ProcessGrid::ProcessGrid ( const MPI_Comm & 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()

dftfe::ProcessGrid::~ProcessGrid ( )

Destructor.

◆ ProcessGrid() [3/3]

dftfe::ProcessGrid::ProcessGrid ( const MPI_Comm & mpi_communicator,
const std::pair< unsigned int, unsigned int > & grid_dimensions )
private

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

Member Function Documentation

◆ get_blacs_context()

int dftfe::ProcessGrid::get_blacs_context ( ) const
inline

Return the blacs_context.

◆ get_process_grid_columns()

unsigned int dftfe::ProcessGrid::get_process_grid_columns ( ) const
inline

Return the number of columns in the processes grid.

◆ get_process_grid_rows()

unsigned int dftfe::ProcessGrid::get_process_grid_rows ( ) const
inline

Return the number of rows in the processes grid.

◆ get_this_process_column()

int dftfe::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()

int dftfe::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()

bool dftfe::ProcessGrid::is_process_active ( ) const
inline

Return true if the process is active within the grid.

◆ send_to_inactive()

template<typename NumberType>
void dftfe::ProcessGrid::send_to_inactive ( 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.

Friends And Related Symbol Documentation

◆ dftfe::ScaLAPACKMatrix

template<typename NumberType>
friend class dftfe::ScaLAPACKMatrix
friend

Member Data Documentation

◆ blacs_context

int dftfe::ProcessGrid::blacs_context
private

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

◆ mpi_communicator

MPI_Comm dftfe::ProcessGrid::mpi_communicator
private

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

◆ mpi_communicator_inactive_with_root

MPI_Comm dftfe::ProcessGrid::mpi_communicator_inactive_with_root
private

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

◆ mpi_process_is_active

bool dftfe::ProcessGrid::mpi_process_is_active
private

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

◆ n_mpi_processes

const unsigned int dftfe::ProcessGrid::n_mpi_processes
private

Total number of MPI processes.

◆ n_process_columns

int dftfe::ProcessGrid::n_process_columns
private

Number of columns in the processes grid.

◆ n_process_rows

int dftfe::ProcessGrid::n_process_rows
private

Number of rows in the processes grid.

◆ this_mpi_process

const unsigned int dftfe::ProcessGrid::this_mpi_process
private

Rank of this MPI process.

◆ this_process_column

int dftfe::ProcessGrid::this_process_column
private

Column of this process in the grid.

It's negative for in-active processes.

◆ this_process_row

int dftfe::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 file: