ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
para_setup.h File Reference

Construction of the parallel communication domain hierarchy. More...

#include "para_collection.h"
#include "para_tag.h"
#include "para_world.h"
#include "mpi.h"
Include dependency graph for para_setup.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  Parallel

Functions

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

Detailed Description

Construction of the parallel communication domain hierarchy.

The domains form a tree rooted at MPI_COMM_WORLD. The first split separates independent calculation images (e.g. NEB replicas, each with its own unit cell); every existing solver domain is then derived from the intra-image domain instead of being hard-wired to MPI_COMM_WORLD:

MPI_COMM_WORLD
|
+-- split by nimage (same MPICommGroup pattern as k-parallelism)
|
| para_esolver_world [color = image_id]
| | all processes belonging to one esolver
| |
| +-- all existing domains are derived from it
| | (instead of being hard-wired to MPI_COMM_WORLD):
| | +-- kmesh / pw (split by kpar)
| | +-- bsame_kdiff / bdiff_ksame (split by bndpar)
| | +-- rgrid / diag (split by diago_proc)
| | +-- matrix
| |
| para_images_world [color = rank_in_esolver]
| cross-image: processes with the same
| rank inside their esolver
Definition parallel_comm.h:15
Definition deltaspin_pw.cpp:7

Degenerate cases follow the existing KP_WORLD convention:

  • nimage == 1: esolver_world is a dup of MPI_COMM_WORLD and images_world is MPI_COMM_NULL (invalid domain).
  • Uneven image split: images_world is MPI_COMM_NULL as well, because corresponding ranks do not exist across all images.