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

Namespaces

namespace  ParaTag
 Domain tag constants for the parallel communication domains.

Classes

class  ParaBandOutput
 Describe replicated or contiguous band-group storage. More...
class  ParaBgroupWorld
 bgroup parallel domain: band group communication topology. More...
class  ParaCollection
 Container for all parallel communication domains. More...
class  ParaDiagWorld
 diag parallel domain: diagonalization group topology. More...
class  ParaKmeshWorld
 k-mesh parallel domain: k-point distribution across pools. More...
class  ParaMatrixWorld
 matrix parallel domain: 2D block-cyclic distribution. More...
class  ParaPwWorld
 pw parallel domain: plane-wave distribution within a pool. More...
class  ParaRgridWorld
 rgrid parallel domain: real-space FFT grid distribution. More...
class  ParaWorld
 Value type describing one MPI communication domain. More...

Functions

ParaWorld make_pw_world ()
 Temporary bridge: construct a pw-domain ParaWorld from the old global POOL_WORLD (MPI) or as a serial domain (non-MPI).
ParaWorld make_band_world ()
 Wrap the legacy BP_WORLD as a band domain, or return a serial domain. The caller must keep the underlying communicator alive while using the domain. Remove this bridge once callers receive the domain from driver initialization.
template void ParaKmeshWorld::pool_collection< std::complex< double > > (std::complex< double > *, const std::complex< double > *, int, int) const
void bcast_bool (bool &v, const ParaWorld &world, int root)
void bcast_int (int &v, const ParaWorld &world, int root)
void bcast_double (double &v, const ParaWorld &world, int root)
void bcast_complex (std::complex< double > &v, const ParaWorld &world, int root)
void bcast_string (std::string &s, const ParaWorld &world, int root)
void bcast_int (int *v, int n, const ParaWorld &world, int root)
void bcast_double (double *v, int n, const ParaWorld &world, int root)
void bcast_complex (std::complex< double > *v, int n, const ParaWorld &world, int root)
void bcast_char (char *v, int n, const ParaWorld &world, int root)
void bcast_string (std::string *v, int n, const ParaWorld &world, int root)
void reduce_all (double &v, const ParaWorld &world)
void reduce_all (int &v, const ParaWorld &world)
void reduce_all (double *v, int n, const ParaWorld &world)
void reduce_min (double &v, const ParaWorld &world)
void reduce_max (double &v, const ParaWorld &world)
void reduce_min (int &v, const ParaWorld &world)
void reduce_max (int &v, const ParaWorld &world)
void barrier (const ParaWorld &world)
void allgather_int (int &v, int *all, const ParaWorld &world)
void allgatherv_double (const double *send, int send_count, double *recv, const int *recv_counts, const int *displs, const ParaWorld &world)
 Gather variable-sized double buffers onto every rank in the domain.
void divide_mpi_groups (int nproc, int num_groups, int rank, bool even, int &procs_in_group, int &my_group, int &rank_in_group)
 Divide nproc processes into num_groups groups.
void split_images (int nproc, int my_rank, int nimage, int &image_id, int &rank_in_esolver, int &esolver_size, ParaWorld &esolver_world, ParaWorld &images_world)
 Split MPI_COMM_WORLD into nimage independent images.
void split_pools (int parent_size, int parent_rank, int bndpar, int kpar, const MPI_Comm &parent_comm, int &nproc_in_pool, int &rank_in_pool, int &my_pool, int &nproc_in_bndgroup, int &rank_in_bpgroup, int &my_bndgroup, ParaWorld &pw_world, ParaWorld &kmesh_world, ParaWorld &bgroup_int, ParaWorld &bgroup_bp)
 Split a parent domain into k-pools and band groups.
ParaWorld split_diag_world (int diag_np, int parent_size, int parent_rank, const MPI_Comm &parent_comm, int &drank, int &dsize, int &dcolor)
 Split a parent domain for diagonalization.
ParaWorld split_grid_world (int diag_np, int parent_size, int parent_rank, const MPI_Comm &parent_comm, int &grank, int &gsize)
 Split a parent domain for the real-space grid.
ParaCollection setup_para_worlds (int nproc, int my_rank, int nimage, int bndpar, int kpar, int diag_np)
 Assemble the full parallel domain hierarchy.

Function Documentation

◆ allgather_int()

void Parallel::allgather_int ( int & v,
int * all,
const ParaWorld & world )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ allgatherv_double()

void Parallel::allgatherv_double ( const double * send,
int send_count,
double * recv,
const int * recv_counts,
const int * displs,
const ParaWorld & world )

Gather variable-sized double buffers onto every rank in the domain.

Parameters
sendLocal input buffer; may be null when send_count is zero.
send_countNumber of local elements.
recvOutput buffer large enough for all received segments.
recv_countsElement counts indexed by domain rank.
displsElement offsets in recv indexed by domain rank.
worldCommunication domain; invalid domains are skipped.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ barrier()

void Parallel::barrier ( const ParaWorld & world)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bcast_bool()

void Parallel::bcast_bool ( bool & v,
const ParaWorld & world,
int root )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bcast_char()

void Parallel::bcast_char ( char * v,
int n,
const ParaWorld & world,
int root )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bcast_complex() [1/2]

void Parallel::bcast_complex ( std::complex< double > & v,
const ParaWorld & world,
int root )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bcast_complex() [2/2]

void Parallel::bcast_complex ( std::complex< double > * v,
int n,
const ParaWorld & world,
int root )
Here is the call graph for this function:

◆ bcast_double() [1/2]

void Parallel::bcast_double ( double & v,
const ParaWorld & world,
int root )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bcast_double() [2/2]

void Parallel::bcast_double ( double * v,
int n,
const ParaWorld & world,
int root )
Here is the call graph for this function:

◆ bcast_int() [1/2]

void Parallel::bcast_int ( int & v,
const ParaWorld & world,
int root )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bcast_int() [2/2]

void Parallel::bcast_int ( int * v,
int n,
const ParaWorld & world,
int root )
Here is the call graph for this function:

◆ bcast_string() [1/2]

void Parallel::bcast_string ( std::string & s,
const ParaWorld & world,
int root )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ bcast_string() [2/2]

void Parallel::bcast_string ( std::string * v,
int n,
const ParaWorld & world,
int root )
Here is the call graph for this function:

◆ divide_mpi_groups()

void Parallel::divide_mpi_groups ( int nproc,
int num_groups,
int rank,
bool even,
int & procs_in_group,
int & my_group,
int & rank_in_group )

Divide nproc processes into num_groups groups.

Replaces Parallel_Global::divide_mpi_groups. Works in both serial and MPI builds.

Parameters
[in]nproctotal number of processes
[in]num_groupsdesired number of groups
[in]rankglobal rank
[in]evenif true, require an even split (assert on failure)
[out]procs_in_groupprocesses per group
[out]my_groupwhich group this rank belongs to
[out]rank_in_grouprank within the group
Here is the caller graph for this function:

◆ make_band_world()

ParaWorld Parallel::make_band_world ( )

Wrap the legacy BP_WORLD as a band domain, or return a serial domain. The caller must keep the underlying communicator alive while using the domain. Remove this bridge once callers receive the domain from driver initialization.

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

◆ make_pw_world()

ParaWorld Parallel::make_pw_world ( )

Temporary bridge: construct a pw-domain ParaWorld from the old global POOL_WORLD (MPI) or as a serial domain (non-MPI).

Hides the #ifdef __MPI from call sites so they stay one-liner. Delete this function (and this file) once ParaCollection is wired into driver initialization and callers receive a ParaWorld& from above.

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

◆ ParaKmeshWorld::pool_collection< std::complex< double > >()

template void Parallel::ParaKmeshWorld::pool_collection< std::complex< double > > ( std::complex< double > * ,
const std::complex< double > * ,
int ,
int  ) const
Here is the call graph for this function:

◆ reduce_all() [1/3]

void Parallel::reduce_all ( double & v,
const ParaWorld & world )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduce_all() [2/3]

void Parallel::reduce_all ( double * v,
int n,
const ParaWorld & world )
Here is the call graph for this function:

◆ reduce_all() [3/3]

void Parallel::reduce_all ( int & v,
const ParaWorld & world )
Here is the call graph for this function:

◆ reduce_max() [1/2]

void Parallel::reduce_max ( double & v,
const ParaWorld & world )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduce_max() [2/2]

void Parallel::reduce_max ( int & v,
const ParaWorld & world )
Here is the call graph for this function:

◆ reduce_min() [1/2]

void Parallel::reduce_min ( double & v,
const ParaWorld & world )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduce_min() [2/2]

void Parallel::reduce_min ( int & v,
const ParaWorld & world )
Here is the call graph for this function:

◆ setup_para_worlds()

ParaCollection Parallel::setup_para_worlds ( int nproc,
int my_rank,
int nimage,
int bndpar,
int kpar,
int diag_np )

Assemble the full parallel domain hierarchy.

Top-level initialization: splits images first, then derives every solver domain from the esolver domain (see the tree diagram in the file header). Replaces the old divide_pools + split_diag_world + split_grid_world sequence in driver.cpp.

Parameters
[in]nproctotal MPI processes (GlobalV::NPROC)
[in]my_rankglobal rank (GlobalV::MY_RANK)
[in]nimagenumber of independent images (1 for a normal run)
[in]bndparnumber of band groups
[in]kparnumber of k-pools
[in]diag_npnumber of diag/grid groups
Returns
ParaCollection containing all domains
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_diag_world()

ParaWorld Parallel::split_diag_world ( int diag_np,
int parent_size,
int parent_rank,
const MPI_Comm & parent_comm,
int & drank,
int & dsize,
int & dcolor )

Split a parent domain for diagonalization.

Replaces Parallel_Global::split_diag_world.

Parameters
[in]diag_npnumber of diag groups
[in]parent_sizenumber of processes in the parent domain
[in]parent_rankrank of this process in the parent domain
[in]parent_commcommunicator the diag domain is split from
[out]drankrank in the diag domain
[out]dsizesize of the diag domain
[out]dcolorcolor (diag group index)
Returns
ParaWorld for the diag domain
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_grid_world()

ParaWorld Parallel::split_grid_world ( int diag_np,
int parent_size,
int parent_rank,
const MPI_Comm & parent_comm,
int & grank,
int & gsize )

Split a parent domain for the real-space grid.

Replaces Parallel_Global::split_grid_world.

Parameters
[in]diag_npnumber of grid groups (same parameter as diag)
[in]parent_sizenumber of processes in the parent domain
[in]parent_rankrank of this process in the parent domain
[in]parent_commcommunicator the grid domain is split from
[out]grankrank in the grid domain
[out]gsizesize of the grid domain
Returns
ParaWorld for the rgrid domain
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_images()

void Parallel::split_images ( int nproc,
int my_rank,
int nimage,
int & image_id,
int & rank_in_esolver,
int & esolver_size,
ParaWorld & esolver_world,
ParaWorld & images_world )

Split MPI_COMM_WORLD into nimage independent images.

Produces the two top-level domains:

  • esolver_world: intra-image communicator (all processes of one esolver), split with color = image_id;
  • images_world: inter-image communicator (same rank_in_esolver across images), split with color = rank_in_esolver; MPI_COMM_NULL when nimage == 1 or the split is uneven.
Parameters
[in]nproctotal number of MPI processes
[in]my_rankglobal rank
[in]nimagenumber of images (>= 1)
[out]image_idimage this rank belongs to
[out]rank_in_esolverrank inside the esolver domain
[out]esolver_sizenumber of processes in the esolver domain
[out]esolver_worldintra-image domain (tag: ParaTag::esolver)
[out]images_worldinter-image domain (tag: ParaTag::images, invalid when nimage == 1 or uneven split)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ split_pools()

void Parallel::split_pools ( int parent_size,
int parent_rank,
int bndpar,
int kpar,
const MPI_Comm & parent_comm,
int & nproc_in_pool,
int & rank_in_pool,
int & my_pool,
int & nproc_in_bndgroup,
int & rank_in_bpgroup,
int & my_bndgroup,
ParaWorld & pw_world,
ParaWorld & kmesh_world,
ParaWorld & bgroup_int,
ParaWorld & bgroup_bp )

Split a parent domain into k-pools and band groups.

Replaces Parallel_Global::divide_pools. All splits are performed inside parent_comm (normally the esolver domain), so the same code works for both single-image and multi-image runs.

Parameters
[in]parent_sizenumber of processes in the parent domain
[in]parent_rankrank of this process in the parent domain
[in]bndparnumber of band groups
[in]kparnumber of k-pools
[in]parent_commcommunicator the pools are split from
[out]nproc_in_poolprocesses per pool
[out]rank_in_poolrank within pool
[out]my_poolpool index
[out]nproc_in_bndgroupprocesses per band group
[out]rank_in_bpgrouprank within the band group
[out]my_bndgroupband group index
[out]pw_worlddomain for POOL_WORLD
[out]kmesh_worlddomain for KP_WORLD (invalid when kpar == 1)
[out]bgroup_intdomain for INT_BGROUP
[out]bgroup_bpdomain for BP_WORLD
Here is the call graph for this function:
Here is the caller graph for this function: