Value type describing one MPI communication domain.
More...
#include <para_world.h>
|
| 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).
|
|
| | 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.
|
|
| std::string | tag_ |
| | domain tag
|
| int | rank_ |
| | rank inside domain
|
| int | size_ |
| | number of processes in domain
|
| MPI_Comm | comm_ |
| | wrapped communicator (never owned/freed here)
|
Value type describing one MPI communication domain.
A ParaWorld couples a domain tag (a short string constant, see para_tag.h) with the communicator, rank and size of the current process inside that domain. It replaces loose globals such as GlobalV::RANK_IN_POOL / POOL_WORLD by an object that functions receive explicitly.
In serial builds (no __MPI) the communicator member does not exist; rank() always returns 0 and size() always returns 1, so call sites compile unchanged in both serial and MPI builds.
◆ ~ParaWorld()
| virtual Parallel::ParaWorld::~ParaWorld |
( |
| ) |
|
|
virtualdefault |
◆ ParaWorld() [1/2]
| Parallel::ParaWorld::ParaWorld |
( |
const std::string & | tag | ) |
|
|
explicitprotected |
Construct a serial (single-process) domain.
Usable in both serial and MPI builds; in MPI builds the communicator is set to MPI_COMM_SELF. Mainly intended for tests and safe fall-back behavior.
- Parameters
-
| [in] | tag | domain tag string (must be non-empty for a meaningful domain; empty tag marks "no domain") |
◆ ParaWorld() [2/2]
| Parallel::ParaWorld::ParaWorld |
( |
const std::string & | tag, |
|
|
const MPI_Comm & | comm ) |
|
protected |
Construct a domain wrapping an existing MPI communicator.
- Parameters
-
| [in] | tag | domain tag string |
| [in] | comm | MPI communicator (may be MPI_COMM_NULL, which yields an invalid domain on this rank) |
◆ comm()
| MPI_Comm Parallel::ParaWorld::comm |
( |
| ) |
const |
|
inline |
Underlying MPI communicator (MPI builds only).
◆ make_mpi()
| ParaWorld Parallel::ParaWorld::make_mpi |
( |
const std::string & | tag, |
|
|
const MPI_Comm & | comm ) |
|
inlinestatic |
Build a domain wrapping an MPI communicator.
Factory for setup functions that need to create ParaWorld objects from split communicators.
◆ make_mpi_ptr()
| std::unique_ptr< ParaWorld > Parallel::ParaWorld::make_mpi_ptr |
( |
const std::string & | tag, |
|
|
const MPI_Comm & | comm ) |
|
inlinestatic |
◆ make_serial()
| std::unique_ptr< ParaWorld > Parallel::ParaWorld::make_serial |
( |
const std::string & | tag | ) |
|
|
inlinestatic |
◆ rank()
| int Parallel::ParaWorld::rank |
( |
| ) |
const |
|
inline |
Rank of this process inside the domain (0 in serial builds).
◆ serial()
| ParaWorld Parallel::ParaWorld::serial |
( |
const std::string & | tag | ) |
|
|
inlinestatic |
Build a serial (size=1, rank=0) domain for the given tag.
Safe degradation used by tests and by ParaCollection when a tag is not found.
◆ size()
| int Parallel::ParaWorld::size |
( |
| ) |
const |
|
inline |
Number of processes in the domain (1 in serial builds).
◆ tag()
| const std::string & Parallel::ParaWorld::tag |
( |
| ) |
const |
|
inline |
◆ valid()
| bool Parallel::ParaWorld::valid |
( |
| ) |
const |
True if this process belongs to the domain.
In MPI builds this means comm() != MPI_COMM_NULL; in serial builds a default/empty domain is invalid, everything else valid.
◆ comm_
| MPI_Comm Parallel::ParaWorld::comm_ |
|
private |
wrapped communicator (never owned/freed here)
◆ rank_
| int Parallel::ParaWorld::rank_ |
|
private |
◆ size_
| int Parallel::ParaWorld::size_ |
|
private |
number of processes in domain
◆ tag_
| std::string Parallel::ParaWorld::tag_ |
|
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_world.h
- /home/runner/work/abacus-develop/abacus-develop/source/source_base/module_parallel/para_world.cpp