Skip to content

Class TempLat::MPICartesianGroup

ClassList > TempLat > MPICartesianGroup

A class keeps the books regarding the process layout relative to the physics lattice. More...

  • #include <mpicartesiangroup.h>

Public Functions

Type Name
MPICartesianGroup (MPICommReference topologyGroup, ptrdiff_t nDimensions, std::vector< int > decomposition, std::vector< int > expectedCoords=std::vector< int >(), std::vector< int > periodic=std::vector< int >())
Constructor that adopts an externally-determined topology, normally the FFT backend's (see FFTTopology , built byFFTMPIDomainSplit::makeMPIGroup ).
MPICartesianGroup (ptrdiff_t nDimensions, std::vector< int > decomposition)
convenience short-hand constructor with MPI_COMM_WORLD
MPICommReference getBaseComm () const
MPI_Comm getComm () const
Get the MPI_Comm already.
const std::vector< int > & getDecomposition () const
The decomposition (grid shape) of this group.
ptrdiff_t getNDimensions () const
const std::vector< int > & getPosition () const
Returns the position of the current process in the cartesian grid. Values are relative to the rank layout, nothing else.
int getRank ()
auto size () const

Detailed Description

Unit test: ctest -R test-mpicartesiangroup

Public Functions Documentation

function MPICartesianGroup [1/2]

Constructor that adopts an externally-determined topology, normally the FFT backend's (see FFTTopology , built byFFTMPIDomainSplit::makeMPIGroup ).

inline TempLat::MPICartesianGroup::MPICartesianGroup (
    MPICommReference topologyGroup,
    ptrdiff_t nDimensions,
    std::vector< int > decomposition,
    std::vector< int > expectedCoords=std::vector< int >(),
    std::vector< int > periodic=std::vector< int >()
) 

The Cartesian communicator is created over topologyGroup with no reordering, so this group's rank->coordinate mapping is exactly that communicator's. expectedCoords, when non-empty, is then checked against the coordinates MPI actually hands back, and a mismatch throws.

This matters because the local starts installed into the layout come from the backend's coordinates, while ghost neighbours come from MPI_Cart_shift on the communicator built here. These used to be two independently-reordered topologies reconciled only by comparing grid shape; when they disagreed, subdomain boundaries exchanged the wrong data silently.

Parameters:

  • topologyGroup the MPI Comm whose rank order defines the topology.
  • nDimensions the dimensionality of the Cartesian setup.
  • decomposition the grid shape (rank counts per lattice dimension).
  • expectedCoords this rank's coordinates as the topology's owner reports them, or empty to skip the cross-check.
  • (optional)periodic per-dimension periodicity (1=true, 0=false). Default all periodic.

function MPICartesianGroup [2/2]

convenience short-hand constructor with MPI_COMM_WORLD

inline TempLat::MPICartesianGroup::MPICartesianGroup (
    ptrdiff_t nDimensions,
    std::vector< int > decomposition
) 


function getBaseComm

inline MPICommReference TempLat::MPICartesianGroup::getBaseComm () const

function getComm

Get the MPI_Comm already.

inline MPI_Comm TempLat::MPICartesianGroup::getComm () const


function getDecomposition

The decomposition (grid shape) of this group.

inline const std::vector< int > & TempLat::MPICartesianGroup::getDecomposition () const


function getNDimensions

inline ptrdiff_t TempLat::MPICartesianGroup::getNDimensions () const

function getPosition

Returns the position of the current process in the cartesian grid. Values are relative to the rank layout, nothing else.

inline const std::vector< int > & TempLat::MPICartesianGroup::getPosition () const


function getRank

inline int TempLat::MPICartesianGroup::getRank () 

function size

inline auto TempLat::MPICartesianGroup::size () const

Friends Documentation

friend operator<<

inline std::ostream & TempLat::MPICartesianGroup::operator<< (
    std::ostream & ostream,
    MPICartesianGroup mGr
) 


The documentation for this class was generated from the following file cosmolatticeweb/tmp/code_source/templat/include/TempLat/parallel/mpi/cartesian/mpicartesiangroup.h