ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
Parallel_2D Class Reference

This class packs the basic information of 2D-block-cyclic parallel distribution of an arbitrary matrix. More...

#include <parallel_2d.h>

Inheritance diagram for Parallel_2D:
Collaboration diagram for Parallel_2D:

Public Member Functions

 Parallel_2D ()=default
 
 ~Parallel_2D ()=default
 
Parallel_2Doperator= (Parallel_2D &&rhs)=default
 
 Parallel_2D (Parallel_2D &&rhs)=default
 
int get_row_size () const
 number of local rows
 
int get_col_size () const
 number of local columns
 
int get_global_row_size () const
 number of global rows
 
int get_global_col_size () const
 number of global columns
 
int64_t get_local_size () const
 number of local matrix elements
 
int global2local_row (const int igr) const
 get the local index of a global index (row)
 
int global2local_col (const int igc) const
 get the local index of a global index (col)
 
int local2global_row (const int ilr) const
 get the global index of a local index (row)
 
int local2global_col (const int ilc) const
 get the global index of a local index (col)
 
bool in_this_processor (const int iw1_all, const int iw2_all) const
 check whether a global index is in this process
 
int get_block_size () const
 side length of 2d square block
 
int init (const int mg, const int ng, const int nb, const MPI_Comm comm, bool mode=false)
 Initialize a BLACS grid with the given MPI communicator and set up the info of a block-cyclic distribution.
 
int set (const int mg, const int ng, const int nb, const int blacs_ctxt)
 Set up the info of a block-cyclic distribution using given BLACS context.
 
MPI_Comm comm () const
 
void set_serial (const int mg, const int ng)
 

Public Attributes

int blacs_ctxt = -1
 BLACS context.
 
int desc [9] = {}
 ScaLAPACK descriptor.
 
int nrow = 0
 local size (nloc = nrow * ncol)
 
int ncol = 0
 
int64_t nloc = 0
 
int nb = 1
 block size
 
int dim0 = 0
 number of processes in each dimension of the MPI Cartesian grid
 
int dim1 = 0
 
int coord [2] = {-1, -1}
 process coordinate in the BLACS grid
 
bool is_serial = false
 whether to use the serial mode
 

Protected Member Functions

void _init_proc_grid (const MPI_Comm comm, const bool mode)
 
void _set_dist_info (const int mg, const int ng, const int nb)
 

Protected Attributes

std::vector< int > global2local_row_
 map from global index to local index
 
std::vector< int > global2local_col_
 
std::vector< int > local2global_row_
 map from local index to global index
 
std::vector< int > local2global_col_
 

Detailed Description

This class packs the basic information of 2D-block-cyclic parallel distribution of an arbitrary matrix.

Constructor & Destructor Documentation

◆ Parallel_2D() [1/2]

Parallel_2D::Parallel_2D ( )
default

◆ ~Parallel_2D()

Parallel_2D::~Parallel_2D ( )
default

◆ Parallel_2D() [2/2]

Parallel_2D::Parallel_2D ( Parallel_2D &&  rhs)
default

Member Function Documentation

◆ _init_proc_grid()

void Parallel_2D::_init_proc_grid ( const MPI_Comm  comm,
const bool  mode 
)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _set_dist_info()

void Parallel_2D::_set_dist_info ( const int  mg,
const int  ng,
const int  nb 
)
protected
Here is the call graph for this function:
Here is the caller graph for this function:

◆ comm()

MPI_Comm Parallel_2D::comm ( ) const
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_block_size()

int Parallel_2D::get_block_size ( ) const
inline

side length of 2d square block

Here is the caller graph for this function:

◆ get_col_size()

int Parallel_2D::get_col_size ( ) const
inline

number of local columns

Here is the caller graph for this function:

◆ get_global_col_size()

int Parallel_2D::get_global_col_size ( ) const

number of global columns

Here is the caller graph for this function:

◆ get_global_row_size()

int Parallel_2D::get_global_row_size ( ) const

number of global rows

Here is the caller graph for this function:

◆ get_local_size()

int64_t Parallel_2D::get_local_size ( ) const
inline

number of local matrix elements

Here is the caller graph for this function:

◆ get_row_size()

int Parallel_2D::get_row_size ( ) const
inline

number of local rows

Here is the caller graph for this function:

◆ global2local_col()

int Parallel_2D::global2local_col ( const int  igc) const
inline

get the local index of a global index (col)

Here is the caller graph for this function:

◆ global2local_row()

int Parallel_2D::global2local_row ( const int  igr) const
inline

get the local index of a global index (row)

Here is the caller graph for this function:

◆ in_this_processor()

bool Parallel_2D::in_this_processor ( const int  iw1_all,
const int  iw2_all 
) const

check whether a global index is in this process

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

◆ init()

int Parallel_2D::init ( const int  mg,
const int  ng,
const int  nb,
const MPI_Comm  comm,
bool  mode = false 
)

Initialize a BLACS grid with the given MPI communicator and set up the info of a block-cyclic distribution.

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

◆ local2global_col()

int Parallel_2D::local2global_col ( const int  ilc) const
inline

get the global index of a local index (col)

Here is the caller graph for this function:

◆ local2global_row()

int Parallel_2D::local2global_row ( const int  ilr) const
inline

get the global index of a local index (row)

Here is the caller graph for this function:

◆ operator=()

Parallel_2D & Parallel_2D::operator= ( Parallel_2D &&  rhs)
default

◆ set()

int Parallel_2D::set ( const int  mg,
const int  ng,
const int  nb,
const int  blacs_ctxt 
)

Set up the info of a block-cyclic distribution using given BLACS context.

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

◆ set_serial()

void Parallel_2D::set_serial ( const int  mg,
const int  ng 
)
Here is the caller graph for this function:

Member Data Documentation

◆ blacs_ctxt

int Parallel_2D::blacs_ctxt = -1

BLACS context.

◆ coord

int Parallel_2D::coord[2] = {-1, -1}

process coordinate in the BLACS grid

◆ desc

int Parallel_2D::desc[9] = {}

ScaLAPACK descriptor.

◆ dim0

int Parallel_2D::dim0 = 0

number of processes in each dimension of the MPI Cartesian grid

◆ dim1

int Parallel_2D::dim1 = 0

◆ global2local_col_

std::vector<int> Parallel_2D::global2local_col_
protected

◆ global2local_row_

std::vector<int> Parallel_2D::global2local_row_
protected

map from global index to local index

◆ is_serial

bool Parallel_2D::is_serial = false

whether to use the serial mode

◆ local2global_col_

std::vector<int> Parallel_2D::local2global_col_
protected

◆ local2global_row_

std::vector<int> Parallel_2D::local2global_row_
protected

map from local index to global index

◆ nb

int Parallel_2D::nb = 1

block size

◆ ncol

int Parallel_2D::ncol = 0

◆ nloc

int64_t Parallel_2D::nloc = 0

◆ nrow

int Parallel_2D::nrow = 0

local size (nloc = nrow * ncol)


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