|
DNDSR 0.1.0.dev1+gcd065ad
Distributed Numeric Data Structure for CFV
|
Ghost-communication engine for a father / son ParArray pair. More...
#include <ArrayTransformer.hpp>
Public Types | |
| using | TArray = ParArray< T, _row_size, _row_max, _align > |
| using | TSelf = ArrayTransformer< T, _row_size, _row_max, _align > |
| using | t_pArray = ssp< TArray > |
Public Member Functions | |
| TSelf & | operator= (const TSelf &R) |
| Copy-assign the transformer state. Persistent requests are re-created rather than shared because they point to different memory than the source object. | |
| ArrayTransformer ()=default | |
| Default-construct an empty transformer; attach arrays later via setFatherSon. | |
| ArrayTransformer (const TSelf &R) | |
| Copy-construct via operator=. | |
| void | setFatherSon (const t_pArray &n_father, const t_pArray &n_son) |
| Attach father and son arrays. First setup step. | |
| template<class TRArrayTrans > | |
| void | BorrowGGIndexing (const TRArrayTrans &RArrayTrans) |
| Borrow the ghost and global mapping from another transformer. | |
| void | createFatherGlobalMapping () |
| Collective: build the global offsets table on the father array. | |
| template<class TPullSet > | |
| void | createGhostMapping (TPullSet &&pullingIndexGlobal) |
| create ghost by pulling data | |
| template<class TPushSet , class TPushStart > | |
| void | createGhostMapping (TPushSet &&pushingIndexLocal, TPushStart &&pushStarts) |
| Create the ghost mapping from a push specification. Collective. | |
| void | createMPITypes () |
| Collective: build the MPI derived datatypes (or in-situ buffers) that describe the ghost send/recv layout. Resizes the son array. | |
| auto | getFatherSonData (DeviceBackend B) |
| void | initPersistentPush (DeviceBackend B=DeviceBackend::Unknown) |
| Initialise persistent, non-blocking, non-buffered MPI requests for the push direction (son -> father). | |
| void | initPersistentPull (DeviceBackend B=DeviceBackend::Unknown) |
| Initialise persistent, non-blocking MPI requests for the pull direction (father -> son). Counterpart to initPersistentPush. | |
| void | __InSituPackStartPush (DeviceBackend B) |
| void | startPersistentPush (DeviceBackend B=DeviceBackend::Unknown) |
| Start all persistent push requests (MPI_Startall). | |
| void | __InSituPackStartPull (DeviceBackend B) |
| void | startPersistentPull (DeviceBackend B=DeviceBackend::Unknown) |
| Start all persistent pull requests (MPI_Startall). | |
| void | waitPersistentPush (DeviceBackend B=DeviceBackend::Unknown) |
| Wait for all outstanding persistent push requests to complete. | |
| void | waitPersistentPull (DeviceBackend B=DeviceBackend::Unknown) |
| Wait for all outstanding persistent pull requests. After this returns, the son array holds fresh ghost data. | |
| void | clearPersistentPush () |
| Wait on outstanding push requests then free them. | |
| void | clearPersistentPull () |
| Wait on outstanding pull requests then free them. | |
| void | clearMPITypes () |
| Release the MPI derived datatypes built by createMPITypes. Rebuild with another call if you wish to continue using the transformer. | |
| void | clearGlobalMapping () |
| Drop the shared pointer to the global offsets table. | |
| void | clearGhostMapping () |
| Drop the ghost mapping (pLGhostMapping). | |
| void | pullOnce () |
| Convenience: init + start + wait + clear a single pull. | |
| void | pushOnce () |
| Convenience: init + start + wait + clear a single push. | |
| void | reInitPersistentPullPush () |
| Re-initialise persistent requests; useful after rebuilding MPI types but wanting to resume persistent comms. Idempotent w.r.t. whichever direction(s) were previously initialised. | |
Public Attributes | |
| MPIInfo | mpi |
| MPI context; copied from the attached father array. | |
| t_pLGhostMapping | pLGhostMapping |
| Ghost index mapping (rank-local layout). Populated by createGhostMapping. | |
| t_pArray | father |
| The "owned" side of the father/son pair. | |
| t_pArray | son |
| The "ghost" side of the father/son pair (receives from other ranks). | |
| t_pLGlobalMapping | pLGlobalMapping |
| Shared pointer to the global offsets table (shared with father). | |
| ssp< tMPI_typePairVec > | pPushTypeVec |
Cached (count, MPI_Datatype) pairs for push (son -> father). | |
| ssp< tMPI_typePairVec > | pPullTypeVec |
Cached (count, MPI_Datatype) pairs for pull (father -> son). | |
| ssp< MPIReqHolder > | PushReqVec |
| Persistent request handles for push. | |
| ssp< MPIReqHolder > | PullReqVec |
| Persistent request handles for pull. | |
| DeviceBackend | pushDevice = DeviceBackend::Unknown |
| Device currently holding push buffers (Unknown if not initialised). | |
| DeviceBackend | pullDevice = DeviceBackend::Unknown |
| Device currently holding pull buffers (Unknown if not initialised). | |
| MPI_int | nRecvPushReq {-1} |
| Number of receive requests in PushReqVec (the rest are sends). | |
| MPI_int | nRecvPullReq {-1} |
| Number of receive requests in PullReqVec. | |
| tMPI_statVec | PushStatVec |
| Status buffer for push completion. | |
| tMPI_statVec | PullStatVec |
| Status buffer for pull completion. | |
| MPI_Aint | pushSendSize |
| Total bytes sent per push call (for buffer sizing). | |
| MPI_Aint | pullSendSize |
| Total bytes sent per pull call. | |
| tMPI_intVec | pushingSizes |
| temp: per-peer count for createMPITypes. | |
| tMPI_AintVec | pushingDisps |
| temp: per-peer byte displacements for createMPITypes. | |
| std::vector< index > | pushingIndexLocal |
| for InSituPack strategy | |
| std::vector< std::vector< T > > | inSituBuffer |
| for InSituPack strategy | |
Static Public Attributes | |
| static const DataLayout | _dataLayout = TArray::_dataLayout |
Ghost-communication engine for a father / son ParArray pair.
Distributed-mesh stencil schemes need data from cells owned by other ranks. ArrayTransformer stores two ParArray pointers – the father (owned rows) and the son (incoming ghost rows) – plus the MPI machinery to move data between them.
MPI_Type_create_hindexed derived types (or in-situ pack buffers) for send/recv.MPI_Isend/MPI_Irecv pair).When multiple arrays share the same ghost pattern (e.g. the DOF array and the gradient array both use the cell2cell partition), call BorrowGGIndexing on the secondary transformer to copy the mapping without redoing collective setup – only createMPITypes must be redone, because the element size differs.
Definition at line 427 of file ArrayTransformer.hpp.
| using DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::t_pArray = ssp<TArray> |
Definition at line 439 of file ArrayTransformer.hpp.
| using DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::TArray = ParArray<T, _row_size, _row_max, _align> |
Definition at line 432 of file ArrayTransformer.hpp.
| using DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::TSelf = ArrayTransformer<T, _row_size, _row_max, _align> |
Definition at line 433 of file ArrayTransformer.hpp.
|
default |
Default-construct an empty transformer; attach arrays later via setFatherSon.
|
inline |
Copy-construct via operator=.
Definition at line 550 of file ArrayTransformer.hpp.
|
inline |
init sizes
init sizes
Definition at line 1174 of file ArrayTransformer.hpp.
|
inline |
init sizes
Definition at line 1090 of file ArrayTransformer.hpp.
|
inline |
Borrow the ghost and global mapping from another transformer.
Intended for the common case where several arrays share the same partition (e.g., the DOF array and the gradient array both live on the same cell partitioning). Copies the shared pointers – no collective work is performed. After this call, createMPITypes still needs to be invoked because the element size differs.
| TRArrayTrans | A compatible transformer type; must expose father, pLGhostMapping, pLGlobalMapping. |
Definition at line 596 of file ArrayTransformer.hpp.
|
inline |
Drop the ghost mapping (pLGhostMapping).
Definition at line 1426 of file ArrayTransformer.hpp.
|
inline |
Drop the shared pointer to the global offsets table.
Definition at line 1420 of file ArrayTransformer.hpp.
|
inline |
Release the MPI derived datatypes built by createMPITypes. Rebuild with another call if you wish to continue using the transformer.
Definition at line 1413 of file ArrayTransformer.hpp.
|
inline |
Wait on outstanding pull requests then free them.
Definition at line 1405 of file ArrayTransformer.hpp.
|
inline |
Wait on outstanding push requests then free them.
Definition at line 1399 of file ArrayTransformer.hpp.
|
inline |
Collective: build the global offsets table on the father array.
Thin wrapper over father->createGlobalMapping() that also caches the pointer in this transformer. Second setup step.
Definition at line 611 of file ArrayTransformer.hpp.
|
inline |
create ghost by pulling data
pulling data indicates the data put in son (received in pulling operation) pullingIndexGlobal is the global indices in son pullingIndexGlobal should be mutually different, otherwise behavior undefined
Definition at line 631 of file ArrayTransformer.hpp.
|
inline |
Create the ghost mapping from a push specification. Collective.
Each rank supplies, grouped per receiver, the local indices it will push to that receiver. Row i of this rank's father will be sent to every rank listed for i across the CSR (pushingIndexLocal, pushStarts). The son array is resized to hold the incoming entries on return from createMPITypes.
| pushingIndexLocal | Flat vector of local indices to push, grouped by receiver in ascending rank order. |
| pushStarts | Prefix-sum offsets into pushingIndexLocal, size mpi.size + 1. |
Definition at line 664 of file ArrayTransformer.hpp.
|
inline |
Collective: build the MPI derived datatypes (or in-situ buffers) that describe the ghost send/recv layout. Resizes the son array.
Fourth (and final) setup step. Consumes the per-rank push sizes and the ghost mapping produced by createGhostMapping, then:
MPI_Type_create_hindexed types that describe the scattered memory layout of the rows being sent and received;Also resizes son to hold exactly the incoming ghost rows.
father, son, pLGlobalMapping, pLGhostMapping are set. pPullTypeVec and pPushTypeVec (or the in-situ buffers) are valid; son has been resized. assure CSR is in compressed form
init sizes
Definition at line 695 of file ArrayTransformer.hpp.
|
inline |
Definition at line 894 of file ArrayTransformer.hpp.
|
inline |
Initialise persistent, non-blocking MPI requests for the pull direction (father -> son). Counterpart to initPersistentPush.
| B | Device backend for the send/recv buffers. |
receives a lot of messages, this distinguishes them
Definition at line 1026 of file ArrayTransformer.hpp.
|
inline |
Initialise persistent, non-blocking, non-buffered MPI requests for the push direction (son -> father).
Once persistent requests are created, many push cycles may be run via startPersistentPush / waitPersistentPush without re-posting sends and receives.
MPI_Send_init / MPI_Recv_init requests.| B | Device backend for the send/recv buffers (DeviceBackend::Unknown to use host; requires CUDA-aware MPI for non-host backends). |
Definition at line 952 of file ArrayTransformer.hpp.
|
inline |
Copy-assign the transformer state. Persistent requests are re-created rather than shared because they point to different memory than the source object.
Definition at line 498 of file ArrayTransformer.hpp.
|
inline |
Convenience: init + start + wait + clear a single pull.
Suitable when ghosts are updated only once (e.g., post-restart); use the persistent API in hot loops.
Definition at line 1434 of file ArrayTransformer.hpp.
|
inline |
Convenience: init + start + wait + clear a single push.
Definition at line 1443 of file ArrayTransformer.hpp.
|
inline |
Re-initialise persistent requests; useful after rebuilding MPI types but wanting to resume persistent comms. Idempotent w.r.t. whichever direction(s) were previously initialised.
Definition at line 1454 of file ArrayTransformer.hpp.
|
inline |
Attach father and son arrays. First setup step.
Both arrays must share the same MPI context and element MPI datatype. The transformer cannot be used until the remaining setup calls (createFatherGlobalMapping, createGhostMapping, createMPITypes) have run.
| n_father | Owned-side array (must not be null). |
| n_son | Ghost-side array (must not be null). |
Definition at line 567 of file ArrayTransformer.hpp.
|
inline |
Start all persistent pull requests (MPI_Startall).
After this call the sends/recvs are in flight; call waitPersistentPull to consume the incoming ghost data.
| B | Device backend; must match the one passed to initPersistentPull. |
Definition at line 1242 of file ArrayTransformer.hpp.
|
inline |
Start all persistent push requests (MPI_Startall).
| B | Device backend; must match the one passed to initPersistentPush. |
Definition at line 1142 of file ArrayTransformer.hpp.
|
inline |
Wait for all outstanding persistent pull requests. After this returns, the son array holds fresh ghost data.
Definition at line 1349 of file ArrayTransformer.hpp.
|
inline |
Wait for all outstanding persistent push requests to complete.
init sizes
Definition at line 1275 of file ArrayTransformer.hpp.
|
static |
Definition at line 440 of file ArrayTransformer.hpp.
| t_pArray DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::father |
The "owned" side of the father/son pair.
Definition at line 451 of file ArrayTransformer.hpp.
| std::vector<std::vector<T> > DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::inSituBuffer |
for InSituPack strategy
Definition at line 489 of file ArrayTransformer.hpp.
| MPIInfo DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::mpi |
MPI context; copied from the attached father array.
Definition at line 447 of file ArrayTransformer.hpp.
| MPI_int DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::nRecvPullReq {-1} |
Number of receive requests in PullReqVec.
Definition at line 476 of file ArrayTransformer.hpp.
| MPI_int DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::nRecvPushReq {-1} |
Number of receive requests in PushReqVec (the rest are sends).
Definition at line 474 of file ArrayTransformer.hpp.
| t_pLGhostMapping DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pLGhostMapping |
Ghost index mapping (rank-local layout). Populated by createGhostMapping.
Definition at line 449 of file ArrayTransformer.hpp.
| t_pLGlobalMapping DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pLGlobalMapping |
Shared pointer to the global offsets table (shared with father).
Definition at line 456 of file ArrayTransformer.hpp.
| ssp<tMPI_typePairVec> DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pPullTypeVec |
Cached (count, MPI_Datatype) pairs for pull (father -> son).
Definition at line 461 of file ArrayTransformer.hpp.
| ssp<tMPI_typePairVec> DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pPushTypeVec |
Cached (count, MPI_Datatype) pairs for push (son -> father).
Definition at line 459 of file ArrayTransformer.hpp.
| DeviceBackend DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pullDevice = DeviceBackend::Unknown |
Device currently holding pull buffers (Unknown if not initialised).
Definition at line 472 of file ArrayTransformer.hpp.
| ssp<MPIReqHolder> DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::PullReqVec |
Persistent request handles for pull.
Definition at line 468 of file ArrayTransformer.hpp.
| MPI_Aint DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pullSendSize |
Total bytes sent per pull call.
Definition at line 484 of file ArrayTransformer.hpp.
| tMPI_statVec DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::PullStatVec |
Status buffer for pull completion.
Definition at line 480 of file ArrayTransformer.hpp.
| DeviceBackend DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pushDevice = DeviceBackend::Unknown |
Device currently holding push buffers (Unknown if not initialised).
Definition at line 470 of file ArrayTransformer.hpp.
| tMPI_AintVec DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pushingDisps |
temp: per-peer byte displacements for createMPITypes.
Definition at line 487 of file ArrayTransformer.hpp.
| std::vector<index> DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pushingIndexLocal |
for InSituPack strategy
Definition at line 488 of file ArrayTransformer.hpp.
| tMPI_intVec DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pushingSizes |
temp: per-peer count for createMPITypes.
Definition at line 486 of file ArrayTransformer.hpp.
| ssp<MPIReqHolder> DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::PushReqVec |
Persistent request handles for push.
Definition at line 466 of file ArrayTransformer.hpp.
| MPI_Aint DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::pushSendSize |
Total bytes sent per push call (for buffer sizing).
Definition at line 482 of file ArrayTransformer.hpp.
| tMPI_statVec DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::PushStatVec |
Status buffer for push completion.
Definition at line 478 of file ArrayTransformer.hpp.
| t_pArray DNDS::ArrayTransformer< T, _row_size, _row_max, _align >::son |
The "ghost" side of the father/son pair (receives from other ranks).
Definition at line 453 of file ArrayTransformer.hpp.