k-mesh parallel domain: k-point distribution across pools.
More...
#include <para_kmesh_world.h>
|
| | ParaKmeshWorld (int nkstot, int nspin) |
| | Construct a serial (single-pool) k-mesh domain.
|
| | ParaKmeshWorld (const MPI_Comm &comm, int kpar, int my_pool, int nproc, int nkstot, int nspin) |
| | Construct a k-mesh domain on an existing communicator.
|
| int | kpar () const |
| | Number of pools.
|
| int | my_pool () const |
| | Pool index of this process.
|
| int | rank_in_pool () const |
| | Rank within the pool.
|
| int | nproc () const |
| | Total number of processes.
|
| int | nspin () const |
| | Number of spin components.
|
| int | nkstot () const |
| | Total number of k-points (without spin).
|
| int | nks_local () const |
| | Number of k-points in this pool.
|
| int | startk_global () const |
| | Global start index of this pool's k-points.
|
| int | nks_pool (int pool) const |
| | Number of k-points in the given pool.
|
| int | startk_pool (int pool) const |
| | Global start index of the given pool's k-points.
|
| int | which_pool (int ik_global) const |
| | Which pool owns the given global k-point index.
|
| int | startpro_pool (int pool) const |
| | First MPI_COMM_WORLD rank of the given pool.
|
| int | max_nks_pool () const |
| | Maximum number of k-points across all pools.
|
| void | pool_collection (double &value, const double *wk, int ik) const |
| | Collect a scalar value from the pool that owns k-point ik.
|
| template<typename T> |
| void | pool_collection (T *value, const T *w, int dim, int ik) const |
| | Collect an array slice from the pool that owns k-point ik.
|
| void | gather_kvec (const std::vector< double > &vec_local, std::vector< double > &vec_global) const |
| | Gather local k-point vectors to global array.
|
| virtual | ~ParaWorld ()=default |
| const std::string & | tag () const |
| | Domain tag string.
|
| int | rank () const |
| | Rank of this process inside the domain (0 in serial builds).
|
| int | size () const |
| | Number of processes in the domain (1 in serial builds).
|
| bool | valid () const |
| | True if this process belongs to the domain.
|
| MPI_Comm | comm () const |
| | Underlying MPI communicator (MPI builds only).
|
|
| static ParaWorld | serial (const std::string &tag) |
| | Build a serial (size=1, rank=0) domain for the given tag.
|
| static std::unique_ptr< ParaWorld > | make_serial (const std::string &tag) |
| | Build a serial domain as a heap-allocated unique_ptr.
|
| static ParaWorld | make_mpi (const std::string &tag, const MPI_Comm &comm) |
| | Build a domain wrapping an MPI communicator.
|
| static std::unique_ptr< ParaWorld > | make_mpi_ptr (const std::string &tag, const MPI_Comm &comm) |
| | ParaWorld (const std::string &tag) |
| | Construct a serial (single-process) domain.
|
| | ParaWorld (const std::string &tag, const MPI_Comm &comm) |
| | Construct a domain wrapping an existing MPI communicator.
|
k-mesh parallel domain: k-point distribution across pools.
Self-contained replacement for Parallel_Kpoints + KP_WORLD + GlobalV::KPAR / MY_POOL / RANK_IN_POOL. Owns all k-point pool topology data and provides query / collection operations.
In serial builds all operations degenerate to single-pool behavior. Tests only need this header; no GlobalV, no parallel_comm.h.
◆ ParaKmeshWorld() [1/2]
| Parallel::ParaKmeshWorld::ParaKmeshWorld |
( |
int | nkstot, |
|
|
int | nspin ) |
Construct a serial (single-pool) k-mesh domain.
- Parameters
-
| [in] | nkstot | total number of k-points (without spin) |
| [in] | nspin | number of spin components |
◆ ParaKmeshWorld() [2/2]
| Parallel::ParaKmeshWorld::ParaKmeshWorld |
( |
const MPI_Comm & | comm, |
|
|
int | kpar, |
|
|
int | my_pool, |
|
|
int | nproc, |
|
|
int | nkstot, |
|
|
int | nspin ) |
Construct a k-mesh domain on an existing communicator.
- Parameters
-
| [in] | comm | k-point pool communicator (e.g. KP_WORLD) |
| [in] | kpar | number of pools |
| [in] | my_pool | pool index of this process |
| [in] | nproc | total number of processes (MPI_COMM_WORLD size) |
| [in] | nkstot | total number of k-points (without spin) |
| [in] | nspin | number of spin components |
◆ distribute_kpoints()
| void Parallel::ParaKmeshWorld::distribute_kpoints |
( |
| ) |
|
|
private |
◆ gather_kvec()
| void Parallel::ParaKmeshWorld::gather_kvec |
( |
const std::vector< double > & | vec_local, |
|
|
std::vector< double > & | vec_global ) const |
Gather local k-point vectors to global array.
Only pool-root processes contribute their local k-points; the result is valid on all ranks after MPI_Allreduce.
- Parameters
-
| [in] | vec_local | local k-point vectors (nks_local elements) |
| [out] | vec_global | global k-point vectors (nkstot elements) |
◆ kpar()
| int Parallel::ParaKmeshWorld::kpar |
( |
| ) |
const |
|
inline |
◆ max_nks_pool()
| int Parallel::ParaKmeshWorld::max_nks_pool |
( |
| ) |
const |
Maximum number of k-points across all pools.
◆ my_pool()
| int Parallel::ParaKmeshWorld::my_pool |
( |
| ) |
const |
|
inline |
Pool index of this process.
◆ nks_local()
| int Parallel::ParaKmeshWorld::nks_local |
( |
| ) |
const |
|
inline |
Number of k-points in this pool.
◆ nks_pool()
| int Parallel::ParaKmeshWorld::nks_pool |
( |
int | pool | ) |
const |
Number of k-points in the given pool.
◆ nkstot()
| int Parallel::ParaKmeshWorld::nkstot |
( |
| ) |
const |
|
inline |
Total number of k-points (without spin).
◆ nproc()
| int Parallel::ParaKmeshWorld::nproc |
( |
| ) |
const |
|
inline |
Total number of processes.
◆ nspin()
| int Parallel::ParaKmeshWorld::nspin |
( |
| ) |
const |
|
inline |
Number of spin components.
◆ pool_collection() [1/2]
| void Parallel::ParaKmeshWorld::pool_collection |
( |
double & | value, |
|
|
const double * | wk, |
|
|
int | ik ) const |
Collect a scalar value from the pool that owns k-point ik.
Pool 0 receives the value; other pools send. Only rank_in_pool==0 participates in the actual communication.
- Parameters
-
| [out] | value | collected value (valid on pool 0 root) |
| [in] | wk | local k-point weights array |
| [in] | ik | global k-point index |
◆ pool_collection() [2/2]
| void Parallel::ParaKmeshWorld::pool_collection |
( |
T * | value, |
|
|
const T * | w, |
|
|
int | dim, |
|
|
int | ik ) const |
Collect an array slice from the pool that owns k-point ik.
- Parameters
-
| [out] | value | output array (dim elements) |
| [in] | w | input array (nkstot * dim elements, row-major by k) |
| [in] | dim | number of elements per k-point |
| [in] | ik | global k-point index |
◆ rank_in_pool()
| int Parallel::ParaKmeshWorld::rank_in_pool |
( |
| ) |
const |
|
inline |
◆ startk_global()
| int Parallel::ParaKmeshWorld::startk_global |
( |
| ) |
const |
|
inline |
Global start index of this pool's k-points.
◆ startk_pool()
| int Parallel::ParaKmeshWorld::startk_pool |
( |
int | pool | ) |
const |
Global start index of the given pool's k-points.
◆ startpro_pool()
| int Parallel::ParaKmeshWorld::startpro_pool |
( |
int | pool | ) |
const |
First MPI_COMM_WORLD rank of the given pool.
◆ which_pool()
| int Parallel::ParaKmeshWorld::which_pool |
( |
int | ik_global | ) |
const |
Which pool owns the given global k-point index.
◆ kpar_
| int Parallel::ParaKmeshWorld::kpar_ = 1 |
|
private |
◆ my_pool_
| int Parallel::ParaKmeshWorld::my_pool_ = 0 |
|
private |
◆ nks_local_
| int Parallel::ParaKmeshWorld::nks_local_ = 0 |
|
private |
◆ nks_pool_
| std::vector<int> Parallel::ParaKmeshWorld::nks_pool_ |
|
private |
◆ nkstot_
| int Parallel::ParaKmeshWorld::nkstot_ = 0 |
|
private |
◆ nproc_
| int Parallel::ParaKmeshWorld::nproc_ = 1 |
|
private |
◆ nspin_
| int Parallel::ParaKmeshWorld::nspin_ = 1 |
|
private |
◆ rank_in_pool_
| int Parallel::ParaKmeshWorld::rank_in_pool_ = 0 |
|
private |
◆ startk_global_
| int Parallel::ParaKmeshWorld::startk_global_ = 0 |
|
private |
◆ startk_pool_
| std::vector<int> Parallel::ParaKmeshWorld::startk_pool_ |
|
private |
global start index per pool
◆ startpro_pool_
| std::vector<int> Parallel::ParaKmeshWorld::startpro_pool_ |
|
private |
first world rank per pool
◆ whichpool_
| std::vector<int> Parallel::ParaKmeshWorld::whichpool_ |
|
private |
The documentation for this class was generated from the following files:
- /home/runner/work/abacus-develop/abacus-develop/source/source_base/module_parallel/para_kmesh_world.h
- /home/runner/work/abacus-develop/abacus-develop/source/source_base/module_parallel/para_kmesh_world.cpp