core 1.8.1
Shared MPI block decomposition, asynchronous ghost-layer exchange, SDF geometry, load balancing (header-only C++20)
Loading...
Searching...
No Matches
peclet::core::halo::GridHalo< T > Class Template Reference

GPU ghost-layer exchange for a contiguous device field peclet::core::View<T> (one element per extended-block cell). More...

#include <grid_halo.hpp>

Public Member Functions

 GridHalo ()=default
 GridHalo (const GridHalo &)=delete
GridHalo & operator= (const GridHalo &)=delete
 ~GridHalo ()
template<int Dim>
void init (const GridHaloTopology< Dim > &halo, int stack=1, Index stride=0)
 Build the exchange from a host topology.
void setLabel (std::string label)
 Name printed by the PECLET_CORE_HALO_TIMEOUT diagnostic (e.g.
int numShmPartners () const
 Number of this rank's partners (send + receive) served by the on-node shared-memory transport; 0 on a device memory space, at one rank, or with PECLET_CORE_HALO_SHM=0 (PECLET_CORE_HALO_SHM_GROUP=k: only the partners in this rank's group of k node ranks).
void exchange (const View< T > &field, int tag=0)
 Exchange ghost layers of the device field field. Blocking (== exchangeBegin+exchangeEnd).
void exchangeBegin (const View< T > &field, int tag=0)
 Start an exchange: periodic self-copy and pack (ONE gather), start the receives and sends, return with the messages in flight.
void exchangeEnd (const View< T > &field)
 Complete the exchange started by exchangeBegin: wait, then scatter the received halo cells into field's ghost region (must be the same field).

Detailed Description

template<class T>
class peclet::core::halo::GridHalo< T >

GPU ghost-layer exchange for a contiguous device field peclet::core::View<T> (one element per extended-block cell).

Build once from a host GridHaloTopology via init(); exchange() runs every step.

Definition at line 201 of file grid_halo.hpp.

Constructor & Destructor Documentation

◆ GridHalo() [1/2]

template<class T>
peclet::core::halo::GridHalo< T >::GridHalo ( )
default

Referenced by GridHalo(), and operator=().

◆ GridHalo() [2/2]

template<class T>
peclet::core::halo::GridHalo< T >::GridHalo ( const GridHalo< T > & )
delete

References GridHalo().

◆ ~GridHalo()

template<class T>
peclet::core::halo::GridHalo< T >::~GridHalo ( )
inline

Definition at line 206 of file grid_halo.hpp.

Member Function Documentation

◆ operator=()

template<class T>
GridHalo & peclet::core::halo::GridHalo< T >::operator= ( const GridHalo< T > & )
delete

References GridHalo().

◆ init()

template<class T>
template<int Dim>
void peclet::core::halo::GridHalo< T >::init ( const GridHaloTopology< Dim > & halo,
int stack = 1,
Index stride = 0 )
inline

Build the exchange from a host topology.

COLLECTIVE over the topology's communicator when the on-node transport is possible (host memory space, more than one rank): every rank of it calls init for this instance, as for GridHaloTopology::buildTopology, and destroys or re-inits the instance at the same point of the program (the shared window is freed collectively).

stack = k > 1 exchanges k fields at once (one gather launch, one message per partner): the fields lie at offsets 0, stride, ..., (k-1) * stride of the ONE view passed to exchange(), each laid out like the topology's block (stride >= its cells incl. ghosts). The ghost values are those of k single-field exchanges, bitwise (FlatTopology::stacked).

Definition at line 222 of file grid_halo.hpp.

References peclet::core::halo::detail::gpuAwareMpi(), and peclet::core::toDevice().

◆ setLabel()

template<class T>
void peclet::core::halo::GridHalo< T >::setLabel ( std::string label)
inline

Name printed by the PECLET_CORE_HALO_TIMEOUT diagnostic (e.g.

"mg L4 g1"), so a stuck exchange can be told apart from the others that share a communicator.

Definition at line 262 of file grid_halo.hpp.

◆ numShmPartners()

template<class T>
int peclet::core::halo::GridHalo< T >::numShmPartners ( ) const
inline

Number of this rank's partners (send + receive) served by the on-node shared-memory transport; 0 on a device memory space, at one rank, or with PECLET_CORE_HALO_SHM=0 (PECLET_CORE_HALO_SHM_GROUP=k: only the partners in this rank's group of k node ranks).

Definition at line 267 of file grid_halo.hpp.

◆ exchange()

template<class T>
void peclet::core::halo::GridHalo< T >::exchange ( const View< T > & field,
int tag = 0 )
inline

Exchange ghost layers of the device field field. Blocking (== exchangeBegin+exchangeEnd).

Definition at line 270 of file grid_halo.hpp.

References exchangeBegin(), and exchangeEnd().

◆ exchangeBegin()

template<class T>
void peclet::core::halo::GridHalo< T >::exchangeBegin ( const View< T > & field,
int tag = 0 )
inline

Start an exchange: periodic self-copy and pack (ONE gather), start the receives and sends, return with the messages in flight.

The caller may run kernels that touch only INNER (non-ghost, non-send) cells before exchangeEnd — that overlap is the point of the split. One exchange may be in flight per GridHalo instance. tag == 0 (every caller today) starts the persistent requests built at init and, on a host memory space, the on-node shared-memory transport; any other tag posts Isend/Irecv on that tag to every partner.

Definition at line 281 of file grid_halo.hpp.

References peclet::core::halo::detail::gpuAwareMpi(), and peclet::core::halo::kHaloSerialCopy.

Referenced by exchange().

◆ exchangeEnd()

template<class T>
void peclet::core::halo::GridHalo< T >::exchangeEnd ( const View< T > & field)
inline

Complete the exchange started by exchangeBegin: wait, then scatter the received halo cells into field's ghost region (must be the same field).

Definition at line 372 of file grid_halo.hpp.

References peclet::core::halo::detail::haloTimeout(), peclet::core::halo::kHaloSerialCopy, MPI_STATUSES_IGNORE, and MPI_Waitall().

Referenced by exchange().


The documentation for this class was generated from the following file: