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

rgrid parallel domain: real-space FFT grid distribution. More...

#include <para_rgrid_world.h>

Inheritance diagram for Parallel::ParaRgridWorld:
Collaboration diagram for Parallel::ParaRgridWorld:

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ ParaRgridWorld() [1/2]

Parallel::ParaRgridWorld::ParaRgridWorld ( int ncx,
int ncy,
int ncz )

Construct a serial rgrid domain (all z-planes on one process).

Parameters
[in]ncx,ncy,nczglobal grid dimensions
Here is the call graph for this function:

◆ ParaRgridWorld() [2/2]

Parallel::ParaRgridWorld::ParaRgridWorld ( const MPI_Comm & comm,
int ncx,
int ncy,
int ncz )

Construct an rgrid domain on an existing communicator.

Parameters
[in]commgrid communicator (e.g. GRID_WORLD)
[in]ncx,ncy,nczglobal grid dimensions
Here is the call graph for this function:

Member Function Documentation

◆ bcast_data()

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).

Parameters
[in]data_globalglobal grid (ncxyz elements, only valid on root)
[out]data_locallocal grid buffer (nrxx elements)
[in]comm_worldcommunicator for broadcast
[in]rootroot rank in comm_world
Here is the call graph for this function:

◆ distribute_z()

void Parallel::ParaRgridWorld::distribute_z ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx()

int Parallel::ParaRgridWorld::ncx ( ) const
inline

Global grid dimension in x.

Here is the caller graph for this function:

◆ ncy()

int Parallel::ParaRgridWorld::ncy ( ) const
inline

Global grid dimension in y.

Here is the caller graph for this function:

◆ ncz()

int Parallel::ParaRgridWorld::ncz ( ) const
inline

Global grid dimension in z.

Here is the caller graph for this function:

◆ nczp()

int Parallel::ParaRgridWorld::nczp ( ) const
inline

Local z-plane count for this process.

Here is the caller graph for this function:

◆ nrxx()

int Parallel::ParaRgridWorld::nrxx ( ) const
inline

Total real-space grid points on this process (ncx * ncy * nczp).

Here is the caller graph for this function:

◆ numz()

int Parallel::ParaRgridWorld::numz ( int p) const

Number of z-planes assigned to process p in this pool.

Here is the caller graph for this function:

◆ reduce_across_pools()

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.

Parameters
[in,out]datalocal grid buffer (nrxx elements), overwritten with sum
[in]kmesh_worldk-mesh domain providing the cross-pool communicator
Here is the call graph for this function:

◆ reduce_data()

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).

Parameters
[out]rhototglobal grid (ncxyz elements, only valid on root)
[in]rhoinlocal grid buffer (nrxx elements)
[in]comm_worldcommunicator for gather
Here is the call graph for this function:

◆ startz()

int Parallel::ParaRgridWorld::startz ( int p) const

Starting global z-index for process p.

Here is the caller graph for this function:

◆ whichpro()

int Parallel::ParaRgridWorld::whichpro ( int iz) const

Which process owns global z-plane iz.

Here is the caller graph for this function:

Member Data Documentation

◆ ncx_

int Parallel::ParaRgridWorld::ncx_ = 0
private

◆ ncy_

int Parallel::ParaRgridWorld::ncy_ = 0
private

◆ ncz_

int Parallel::ParaRgridWorld::ncz_ = 0
private

◆ nczp_

int Parallel::ParaRgridWorld::nczp_ = 0
private

local z-plane count

◆ numz_

std::vector<int> Parallel::ParaRgridWorld::numz_
private

z-planes per process

◆ startz_

std::vector<int> Parallel::ParaRgridWorld::startz_
private

start z-index per process

◆ whichpro_

std::vector<int> Parallel::ParaRgridWorld::whichpro_
private

owner of each global z-plane


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