|
ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
|
rgrid parallel domain: real-space FFT grid distribution. More...
#include <para_rgrid_world.h>
Public Member Functions | |
| ParaRgridWorld (int ncx, int ncy, int ncz) | |
| Construct a serial rgrid domain (all z-planes on one process). | |
| ParaRgridWorld (const MPI_Comm &comm, int ncx, int ncy, int ncz) | |
| Construct an rgrid domain on an existing communicator. | |
| int | ncx () const |
| Global grid dimension in x. | |
| int | ncy () const |
| Global grid dimension in y. | |
| int | ncz () const |
| Global grid dimension in z. | |
| int | nczp () const |
| Local z-plane count for this process. | |
| int | nrxx () const |
| Total real-space grid points on this process (ncx * ncy * nczp). | |
| int | numz (int p) const |
| Number of z-planes assigned to process p in this pool. | |
| int | startz (int p) const |
| Starting global z-index for process p. | |
| int | whichpro (int iz) const |
| Which process owns global z-plane iz. | |
| void | reduce_across_pools (double *data, const ParaWorld &kmesh_world) const |
| Sum local grid data across all pools (KP_WORLD or INT_BGROUP). | |
| void | bcast_data (const double *data_global, double *data_local, const ParaWorld &comm_world, int root=0) const |
| Broadcast global grid to local z-slabs (replaces Parallel_Grid::bcast). | |
| void | reduce_data (double *rhotot, const double *rhoin, const ParaWorld &comm_world) const |
| Gather local z-slabs into a global grid (replaces Parallel_Grid::reduce). | |
| Public Member Functions inherited from Parallel::ParaWorld | |
| 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). | |
Private Member Functions | |
| void | distribute_z () |
Private Attributes | |
| int | ncx_ = 0 |
| int | ncy_ = 0 |
| int | ncz_ = 0 |
| int | nczp_ = 0 |
| local z-plane count | |
| std::vector< int > | numz_ |
| z-planes per process | |
| std::vector< int > | startz_ |
| start z-index per process | |
| std::vector< int > | whichpro_ |
| owner of each global z-plane | |
Additional Inherited Members | |
| Static Public Member Functions inherited from Parallel::ParaWorld | |
| 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) |
| Protected Member Functions inherited from Parallel::ParaWorld | |
| 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. | |
rgrid parallel domain: real-space FFT grid distribution.
Self-contained replacement for GRID_WORLD + GlobalV::GRANK/GSIZE + Parallel_Grid's z-distribution tables. Owns grid dimensions and the per-process z-plane allocation (numz/startz/whichpro).
Cross-pool operations (reduce_across_pools, bcast, reduce) will accept communicators as parameters rather than reading global POOL_WORLD/ KP_WORLD, breaking the cross-domain dependency.
Tests only need this header.
| Parallel::ParaRgridWorld::ParaRgridWorld | ( | int | ncx, |
| int | ncy, | ||
| int | ncz ) |
Construct a serial rgrid domain (all z-planes on one process).
| [in] | ncx,ncy,ncz | global grid dimensions |
| Parallel::ParaRgridWorld::ParaRgridWorld | ( | const MPI_Comm & | comm, |
| int | ncx, | ||
| int | ncy, | ||
| int | ncz ) |
Construct an rgrid domain on an existing communicator.
| [in] | comm | grid communicator (e.g. GRID_WORLD) |
| [in] | ncx,ncy,ncz | global grid dimensions |
| void Parallel::ParaRgridWorld::bcast_data | ( | const double * | data_global, |
| double * | data_local, | ||
| const ParaWorld & | comm_world, | ||
| int | root = 0 ) const |
Broadcast global grid to local z-slabs (replaces Parallel_Grid::bcast).
| [in] | data_global | global grid (ncxyz elements, only valid on root) |
| [out] | data_local | local grid buffer (nrxx elements) |
| [in] | comm_world | communicator for broadcast |
| [in] | root | root rank in comm_world |
|
private |
|
inline |
Global grid dimension in x.
|
inline |
Global grid dimension in y.
|
inline |
Global grid dimension in z.
|
inline |
Local z-plane count for this process.
|
inline |
Total real-space grid points on this process (ncx * ncy * nczp).
| int Parallel::ParaRgridWorld::numz | ( | int | p | ) | const |
Number of z-planes assigned to process p in this pool.
| void Parallel::ParaRgridWorld::reduce_across_pools | ( | double * | data, |
| const ParaWorld & | kmesh_world ) const |
Sum local grid data across all pools (KP_WORLD or INT_BGROUP).
Replaces Parallel_Grid::reduce_across_pools. In serial mode or single-pool, this is a no-op.
| [in,out] | data | local grid buffer (nrxx elements), overwritten with sum |
| [in] | kmesh_world | k-mesh domain providing the cross-pool communicator |
| void Parallel::ParaRgridWorld::reduce_data | ( | double * | rhotot, |
| const double * | rhoin, | ||
| const ParaWorld & | comm_world ) const |
Gather local z-slabs into a global grid (replaces Parallel_Grid::reduce).
| [out] | rhotot | global grid (ncxyz elements, only valid on root) |
| [in] | rhoin | local grid buffer (nrxx elements) |
| [in] | comm_world | communicator for gather |
| int Parallel::ParaRgridWorld::startz | ( | int | p | ) | const |
Starting global z-index for process p.
| int Parallel::ParaRgridWorld::whichpro | ( | int | iz | ) | const |
Which process owns global z-plane iz.
|
private |
|
private |
|
private |
|
private |
local z-plane count
|
private |
z-planes per process
|
private |
start z-index per process
|
private |
owner of each global z-plane