ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
Parallel_Kpoints Class Reference

Parallel_Kpoints class for k-point parallelization. More...

#include <parallel_kpoints.h>

Collaboration diagram for Parallel_Kpoints:

Public Member Functions

 Parallel_Kpoints ()
 Default constructor.
 ~Parallel_Kpoints ()
 Destructor.
void kinfo (int &nkstot_in, const int &kpar_in, const int &my_pool_in, const int &rank_in_pool_in, const int &nproc_in, const int &nspin_in)
 Initialize k-point parallelization information.
void pool_collection (double &value, const double *wk, const int &ik)
 Collect value from each pool to wk.
void pool_collection (double *valuea, double *valueb, const ModuleBase::realArray &a, const ModuleBase::realArray &b, const int &ik)
 Collect value from each pool to overlap.
void pool_collection (std::complex< double > *value, const ModuleBase::ComplexArray &w, const int &ik) const
 Collect complex value from each pool.
template<class T, class V>
void pool_collection_aux (T *value, const V &w, const int &dim, const int &ik) const
 Auxiliary template function for pool collection.
void gatherkvec (const std::vector< ModuleBase::Vector3< double > > &vec_local, std::vector< ModuleBase::Vector3< double > > &vec_global) const
 Gather k-points from all processors.
int get_startpro_pool (const int &pool) const
 Get the first processor in the pool.
int get_max_nks_pool () const
 Get the maximum number of k-points in all pools.

Public Attributes

std::vector< int > nks_pool
 K-point information.
std::vector< int > startk_pool
 the first k-point in each pool (without spin)
std::vector< int > whichpool
 whichpool[k]: the pool which k belongs to, dim: nkstot_np
int nkstot_np = 0
 number of k-points without spin
int nks_np = 0
 number of k-points without spin in the present pool
int kpar = 0
 number of pools
int my_pool = 0
 the pool index of the present processor
int rank_in_pool = 0
 the rank in the present pool
int nproc = 1
 number of processors
int nspin = 1
 number of spins

Private Member Functions

void get_nks_pool (const int &nkstot)
 Get number of k-points in each pool.
void get_startk_pool (const int &nkstot)
 Get start k-point index for each pool.
void get_whichpool (const int &nkstot)
 Get which pool each k-point belongs to.
void set_startpro_pool ()
 Set first processor for each pool.

Private Attributes

std::vector< int > startpro_pool
 the first processor in each pool

Detailed Description

Parallel_Kpoints class for k-point parallelization.

Constructor & Destructor Documentation

◆ Parallel_Kpoints()

Parallel_Kpoints::Parallel_Kpoints ( )
inline

Default constructor.

◆ ~Parallel_Kpoints()

Parallel_Kpoints::~Parallel_Kpoints ( )
inline

Destructor.

Member Function Documentation

◆ gatherkvec()

void Parallel_Kpoints::gatherkvec ( const std::vector< ModuleBase::Vector3< double > > & vec_local,
std::vector< ModuleBase::Vector3< double > > & vec_global ) const

Gather k-points from all processors.

Parameters
vec_localk-point vector in local processor
vec_globalk-point vector in all processors
Here is the caller graph for this function:

◆ get_max_nks_pool()

int Parallel_Kpoints::get_max_nks_pool ( ) const
inline

Get the maximum number of k-points in all pools.

Returns
maximum number of k-points

◆ get_nks_pool()

void Parallel_Kpoints::get_nks_pool ( const int & nkstot)
private

Get number of k-points in each pool.

Parameters
nkstottotal number of k-points
Here is the caller graph for this function:

◆ get_startk_pool()

void Parallel_Kpoints::get_startk_pool ( const int & nkstot)
private

Get start k-point index for each pool.

Parameters
nkstottotal number of k-points
Here is the caller graph for this function:

◆ get_startpro_pool()

int Parallel_Kpoints::get_startpro_pool ( const int & pool) const
inline

Get the first processor in the pool.

Parameters
poolpool index
Returns
first processor in the pool
Here is the caller graph for this function:

◆ get_whichpool()

void Parallel_Kpoints::get_whichpool ( const int & nkstot)
private

Get which pool each k-point belongs to.

Parameters
nkstottotal number of k-points
Here is the caller graph for this function:

◆ kinfo()

void Parallel_Kpoints::kinfo ( int & nkstot_in,
const int & kpar_in,
const int & my_pool_in,
const int & rank_in_pool_in,
const int & nproc_in,
const int & nspin_in )

Initialize k-point parallelization information.

Parameters
nkstot_intotal number of k-points
kpar_innumber of pools
my_pool_inpool index of current processor
rank_in_pool_inrank within pool
nproc_innumber of processors
nspin_innumber of spin components
Note
the kpoints here are reduced after symmetry applied.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pool_collection() [1/3]

void Parallel_Kpoints::pool_collection ( double & value,
const double * wk,
const int & ik )

Collect value from each pool to wk.

Parameters
valueoutput collected value
wkk-point weights
ikk-point index
Here is the caller graph for this function:

◆ pool_collection() [2/3]

void Parallel_Kpoints::pool_collection ( double * valuea,
double * valueb,
const ModuleBase::realArray & a,
const ModuleBase::realArray & b,
const int & ik )

Collect value from each pool to overlap.

Parameters
valueaoutput collected value a
valueboutput collected value b
ainput array a
binput array b
ikk-point index
Here is the call graph for this function:

◆ pool_collection() [3/3]

void Parallel_Kpoints::pool_collection ( std::complex< double > * value,
const ModuleBase::ComplexArray & w,
const int & ik ) const

Collect complex value from each pool.

Parameters
valueoutput collected value
winput complex array
ikk-point index
Here is the call graph for this function:

◆ pool_collection_aux()

template<class T, class V>
void Parallel_Kpoints::pool_collection_aux ( T * value,
const V & w,
const int & dim,
const int & ik ) const

Auxiliary template function for pool collection.

Parameters
valueoutput collected value
winput array
dimdimension
ikk-point index
Here is the caller graph for this function:

◆ set_startpro_pool()

void Parallel_Kpoints::set_startpro_pool ( )
private

Set first processor for each pool.

Here is the caller graph for this function:

Member Data Documentation

◆ kpar

int Parallel_Kpoints::kpar = 0

number of pools

◆ my_pool

int Parallel_Kpoints::my_pool = 0

the pool index of the present processor

◆ nks_np

int Parallel_Kpoints::nks_np = 0

number of k-points without spin in the present pool

◆ nks_pool

std::vector<int> Parallel_Kpoints::nks_pool

K-point information.

number of k-points in each pool (without spin)

◆ nkstot_np

int Parallel_Kpoints::nkstot_np = 0

number of k-points without spin

◆ nproc

int Parallel_Kpoints::nproc = 1

number of processors

◆ nspin

int Parallel_Kpoints::nspin = 1

number of spins

◆ rank_in_pool

int Parallel_Kpoints::rank_in_pool = 0

the rank in the present pool

◆ startk_pool

std::vector<int> Parallel_Kpoints::startk_pool

the first k-point in each pool (without spin)

◆ startpro_pool

std::vector<int> Parallel_Kpoints::startpro_pool
private

the first processor in each pool

◆ whichpool

std::vector<int> Parallel_Kpoints::whichpool

whichpool[k]: the pool which k belongs to, dim: nkstot_np


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