Process topology, collective communication, guard exchange, and timing. More...
#include "pputil.hpp"
Static Public Member Functions | |
| static void | barrier () |
Synchronize all ranks in MPI_COMM_WORLD. | |
| static void | guard (Kokkos::View< Real ** > &f, int nidbas) |
| Fill periodic poloidal guard cells of a two-dimensional mesh field. | |
| static void | guard (Kokkos::View< Real ***, Kokkos::LayoutStride > f, int nidbas, int flag) |
| Exchange toroidal guard planes of a three-dimensional mesh field. | |
| static void | heapcheck (const std::string &message) |
| Compatibility hook for reporting heap use. | |
| static void | mpiabort () |
Abort MPI_COMM_WORLD with error code -1. | |
| static void | ppbcast (int &f, int icomm) |
| Broadcast a real scalar from rank zero of a communicator. | |
| static void | ppbcast (Real &f, int icomm) |
| Broadcast a real scalar from rank zero of a communicator. | |
| static void | ppbcast (std::vector< int > &f, int icomm) |
| Broadcast an integer vector from communicator rank zero. | |
| static void | ppbcast (std::vector< Real > &f, int icomm) |
| Broadcast a real vector from communicator rank zero. | |
| static void | ppexit () |
| Synchronize all world ranks at the end of the run. | |
| static void | ppinit () |
| Initialize MPI when the caller has not already done so. | |
| static void | ppmax (int &f, int icomm) |
| Replace a real scalar with its communicator-wide maximum. | |
| static void | ppmax (Real &f, int icomm) |
| Replace a real scalar with its communicator-wide maximum. | |
| static void | ppmax (std::vector< int > &f, int icomm) |
| Replace each integer vector element with its collective maximum. | |
| static void | ppmax (std::vector< Real > &f, int icomm) |
| Replace each real vector element with its collective maximum. | |
| static void | ppmin (int &f, int icomm) |
| Replace a real scalar with its communicator-wide minimum. | |
| static void | ppmin (Real &f, int icomm) |
| Replace a real scalar with its communicator-wide minimum. | |
| static void | ppmin (std::vector< int > &f, int icomm) |
| Replace each integer vector element with its collective minimum. | |
| static void | ppmin (std::vector< Real > &f, int icomm) |
| Replace each real vector element with its collective minimum. | |
| static void | ppsum (int &f, int icomm) |
| Sum a scalar in place across the selected communicator. | |
| static void | ppsum (Real &f, int icomm) |
| Sum a scalar in place across the selected communicator. | |
| static void | ppsum (Real *f, int count, int icomm) |
| Sum a contiguous real buffer in place across a communicator. | |
| static void | ppsum (std::vector< int > &f, int icomm) |
| Sum every integer element in place across a communicator. | |
| static void | ppsum (std::vector< Real > &f, int icomm) |
| Sum every real element in place across a communicator. | |
| static void | pptopology (bool bycol=false) |
| Construct the spatial-domain and clone process topology. | |
| static void | timera (int icntrl, const std::string &string, Real *eltime=nullptr, bool do_barrier=true) |
| Start or stop one of the ten named wall-clock timers. | |
Process topology, collective communication, guard exchange, and timing.
Pputil is the MPI compatibility layer used by the rest of ORB5X. It owns no MPI resources itself; communicator handles and ranks are stored in the global Parallel state. Call ppinit() before pptopology(), and keep MPI alive until all collectives and guard exchanges have completed.
Communicator selectors used by the collective routines are:
1: MPI_COMM_WORLD;2: the toroidal spatial-domain communicator (comm_sd);3: the clone communicator (comm_clones);4: the radial-column communicator (comm_krcol);5: the conjugate-gradient communicator (comm_cg).Any other selector currently falls back to MPI_COMM_WORLD for compatibility with the original ORB5 utility module.
|
static |
Synchronize all ranks in MPI_COMM_WORLD.
|
static |
Fill periodic poloidal guard cells of a two-dimensional mesh field.
| [in,out] | f | Field indexed by radial and poloidal mesh coordinates. |
| [in] | nidbas | B-spline degree: 1 (linear), 2 (quadratic), or 3 (cubic). |
The physical poloidal extent is obtained from the global field state; no inter-process communication is performed by this overload.
|
static |
Exchange toroidal guard planes of a three-dimensional mesh field.
| [in,out] | f | Mesh values whose third extent contains toroidal guards. |
| [in] | nidbas | B-spline degree: 1 (linear), 2 (quadratic), or 3 (cubic). |
| [in] | flag | Exchange mode: 0 folds deposited ghost values into the physical edge and clears the ghosts; 1 copies physical edge values into ghost planes. |
Neighbor communication uses the periodic comm_sd topology. For a single spatial subdomain the equivalent periodic update is performed locally. In copy mode, compatible poloidal (chi) guards are also filled.
|
static |
Compatibility hook for reporting heap use.
| [in] | message | Context label retained for source compatibility. |
|
static |
Abort MPI_COMM_WORLD with error code -1.
|
static |
Broadcast a real scalar from rank zero of a communicator.
| [in,out] | f | Root value on entry and the broadcast value on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Broadcast a real scalar from rank zero of a communicator.
| [in,out] | f | Root value on entry and the broadcast value on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Broadcast an integer vector from communicator rank zero.
| [in,out] | f | Root vector on entry and broadcast vector on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Broadcast a real vector from communicator rank zero.
| [in,out] | f | Root vector on entry and broadcast vector on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Synchronize all world ranks at the end of the run.
This compatibility routine deliberately does not call MPI_Finalize; main finalizes Kokkos before finalizing MPI.
|
static |
Initialize MPI when the caller has not already done so.
Records the world size and rank in the global parallel state and starts timer slot 2. It is safe to call after MPI has been initialized.
|
static |
Replace a real scalar with its communicator-wide maximum.
| [in,out] | f | Local value on entry and maximum on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Replace a real scalar with its communicator-wide maximum.
| [in,out] | f | Local value on entry and maximum on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Replace each integer vector element with its collective maximum.
| [in,out] | f | Values reduced element by element in place. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Replace each real vector element with its collective maximum.
| [in,out] | f | Values reduced element by element in place. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Replace a real scalar with its communicator-wide minimum.
| [in,out] | f | Local value on entry and minimum on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Replace a real scalar with its communicator-wide minimum.
| [in,out] | f | Local value on entry and minimum on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Replace each integer vector element with its collective minimum.
| [in,out] | f | Values reduced element by element in place. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Replace each real vector element with its collective minimum.
| [in,out] | f | Values reduced element by element in place. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Sum a scalar in place across the selected communicator.
| [in,out] | f | Local value on entry and global sum on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Sum a scalar in place across the selected communicator.
| [in,out] | f | Local value on entry and global sum on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Sum a contiguous real buffer in place across a communicator.
| [in,out] | f | Pointer to at least count local values, replaced by sums. |
| [in] | count | Number of elements in f. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Sum every integer element in place across a communicator.
| [in,out] | f | Local vector on entry and element-wise sums on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Sum every real element in place across a communicator.
| [in,out] | f | Local vector on entry and element-wise sums on return. |
| [in] | icomm | Communicator selector documented by Pputil. |
|
static |
Construct the spatial-domain and clone process topology.
| [in] | bycol | If true, exchange the coordinate ordering used to split world ranks between spatial domains and clones. |
The routine populates nsd, comm_sd, comm_clones, their local ranks, and the available thread count in the global parallel state. The spatial communicator is periodic in the toroidal direction. A non-positive or incompatible clone count is replaced by one.
|
static |
Start or stop one of the ten named wall-clock timers.
| [in] | icntrl | Timer selector. -N or 0 starts timer |N|, while +N stops it; valid absolute timer numbers are 1–10. |
| [in] | string | Human-readable timer label used when elapsed time is printed by the world root. |
| [out] | eltime | Optional time result in seconds. On start this is the MPI wall-clock timestamp; on stop it is elapsed time. |
| [in] | do_barrier | If true, synchronize MPI_COMM_WORLD before reading the clock. |