|
Nektar++
|
Persistent point-to-point exchange of shared data with neighbouring ranks. More...
#include <AssemblyComm.h>
Classes | |
| struct | SendRecvBlock |
Public Member Functions | |
| AssemblyComm (LibUtilities::CommSharedPtr comm, const Array< OneD, long > &gids_to_uids) | |
| AssemblyComm (LibUtilities::CommSharedPtr comm, const std::map< int, std::vector< size_t > > &sharedEntries) | |
| Construct from connectivity discovered elsewhere. | |
| void | InitSendRecvComms () |
| void | InitSendRecvComms (const unsigned nstorage, TData *send_storage_ptr, TData *recv_storage_ptr, const unsigned numComp=1) |
| void | InitSendRecvCommsVar (TData *send_storage_ptr, const std::vector< size_t > &sendCounts, TData *recv_storage_ptr, const std::vector< size_t > &recvCounts) |
| Open persistent requests for payloads that differ in size from entry to entry. | |
| const std::vector< size_t > & | GetSendOffsets () const |
| Start of each entry's payload in the send buffer, with a final entry holding the total. Valid after InitSendRecvCommsVar(). | |
| const std::vector< size_t > & | GetRecvOffsets () const |
| Start of each entry's payload in the receive buffer; see GetSendOffsets(). | |
| const std::vector< unsigned > & | GetFromRank () const |
| const std::vector< size_t > & | GetSREntries () const |
| void | BeginComm () |
| void | EndComm () |
| void | EndAssemble (Array< OneD, TData > &values) |
| void | BeginAssemble (const Array< OneD, TData > &values) |
| void | FillUniqueMap (Array< OneD, long > &unique) |
Private Member Functions | |
| void | DiscoverSharedIDsRing () |
| void | BuildSendRecvMaps () |
Static Private Member Functions | |
| static void | BuildOffsets (const std::vector< size_t > &counts, std::vector< size_t > &offsets) |
| Turn per-entry counts into the running sum the buffers are laid out by. | |
Private Attributes | |
| std::vector< size_t > | m_sr_entries |
| List of entries that map local indices to send/recv storage. | |
| std::vector< unsigned > | m_fromRank |
| rank where assembled point has been communciated from | |
| std::vector< SendRecvBlock > | m_sr_blocks |
| std::vector< TData > | m_send_storage |
| Send storage if required. | |
| std::vector< TData > | m_recv_storage |
| Recv storage if required. | |
| std::vector< size_t > | m_send_offsets |
| Running sums of the per-entry payload sizes, when those vary; see InitSendRecvCommsVar(). Both hold one more element than there are entries, the last being the buffer total. | |
| std::vector< size_t > | m_recv_offsets |
| LibUtilities::CommRequestSharedPtr | m_send_reqs = nullptr |
| Send requests. | |
| LibUtilities::CommRequestSharedPtr | m_recv_reqs = nullptr |
| Recv requests. | |
| LibUtilities::CommSharedPtr | m_comm |
| unsigned | m_rank |
| unsigned | m_size |
| Array< OneD, long > | m_gids_to_uids |
| List of local IDs, where each entry denotes a potential shared dof. 0 entry denotes local to this process, no communication required. | |
| std::unordered_map< long, std::vector< int > > | m_uid_to_ranks |
| Map each ID to a vector of ranks that own this ID. | |
| std::unordered_map< long, size_t > | m_uid_to_index |
| Map each ID to the index inside m_local_ids where it lives. | |
Persistent point-to-point exchange of shared data with neighbouring ranks.
Was AssemblyCommCG, and continuous assembly is still what the first constructor serves: given a local-index-to-universal-id map it discovers which ranks share each id, groups the shared entries by rank, and opens a persistent send/receive request per neighbour so that a step reduces to BeginComm() / EndComm() around whatever local work can overlap it.
None of that machinery is specific to a continuous field, which is why the name no longer says CG. A discontinuous trace flux shares the same shape - a set of entries, each owned jointly with exactly one other rank, exchanged every step - and reaches it through the second constructor, which takes connectivity already discovered rather than rediscovering it here.
The assembly path exchanges one value per entry, or numComp of them, and uses the InitSendRecvComms() overloads taking a component count. A trace carries a whole quadrature line or face per entry, and under variable polynomial order the two sides of a trace need not even carry the same number of points, so the payload is neither one value nor a fixed multiple of one. That case uses InitSendRecvCommsVar(), which takes an explicit element count per entry for each direction and lays the buffers out as their running sums; GetSendOffsets() and GetRecvOffsets() then say where each entry's payload begins.
Definition at line 77 of file AssemblyComm.h.
|
inline |
Definition at line 80 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps(), Nektar::MultiRegions::AssemblyComm< TData >::DiscoverSharedIDsRing(), Nektar::MultiRegions::AssemblyComm< TData >::m_rank, and Nektar::MultiRegions::AssemblyComm< TData >::m_size.
|
inline |
Construct from connectivity discovered elsewhere.
The other constructor finds its neighbours by passing every local id round a ring of all P ranks. A caller that already knows who its neighbours are - having resolved them through LibUtilities::SharedPayloadResolver, say, which answers in two rendezvous exchanges rather than P - has no reason to pay for that again, and hands the answer in here instead.
| comm | Communicator to exchange over. |
| sharedEntries | Local entry indices to exchange with each neighbouring rank. Both ends of every pair must list their entries in a matching order, since it is position within the list, and nothing else, that pairs a sent entry with a received one. Order by an id both ranks agree on to get that. |
Definition at line 109 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::m_fromRank, Nektar::MultiRegions::AssemblyComm< TData >::m_rank, Nektar::MultiRegions::AssemblyComm< TData >::m_size, Nektar::MultiRegions::AssemblyComm< TData >::m_sr_blocks, Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries, and rank.
|
inline |
Definition at line 277 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::BeginComm(), Nektar::MultiRegions::AssemblyComm< TData >::m_send_storage, and Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries.
|
inline |
Definition at line 243 of file AssemblyComm.h.
References ASSERTL1, Nektar::MultiRegions::AssemblyComm< TData >::m_comm, Nektar::MultiRegions::AssemblyComm< TData >::m_recv_reqs, and Nektar::MultiRegions::AssemblyComm< TData >::m_send_reqs.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::BeginAssemble().
|
inlinestaticprivate |
Turn per-entry counts into the running sum the buffers are laid out by.
Definition at line 343 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar().
|
inlineprivate |
Definition at line 456 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::m_fromRank, Nektar::MultiRegions::AssemblyComm< TData >::m_gids_to_uids, Nektar::MultiRegions::AssemblyComm< TData >::m_rank, Nektar::MultiRegions::AssemblyComm< TData >::m_sr_blocks, Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries, Nektar::MultiRegions::AssemblyComm< TData >::m_uid_to_index, Nektar::MultiRegions::AssemblyComm< TData >::m_uid_to_ranks, and rank.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm().
|
inlineprivate |
Definition at line 368 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::m_comm, Nektar::MultiRegions::AssemblyComm< TData >::m_gids_to_uids, Nektar::MultiRegions::AssemblyComm< TData >::m_rank, Nektar::MultiRegions::AssemblyComm< TData >::m_size, Nektar::MultiRegions::AssemblyComm< TData >::m_uid_to_ranks, and rank.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm().
|
inline |
Definition at line 266 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::EndComm(), Nektar::MultiRegions::AssemblyComm< TData >::m_recv_storage, and Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries.
|
inline |
Definition at line 255 of file AssemblyComm.h.
References ASSERTL1, Nektar::MultiRegions::AssemblyComm< TData >::m_comm, Nektar::MultiRegions::AssemblyComm< TData >::m_recv_reqs, and Nektar::MultiRegions::AssemblyComm< TData >::m_send_reqs.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::EndAssemble().
|
inline |
Definition at line 288 of file AssemblyComm.h.
References ASSERTL0, Nektar::MultiRegions::AssemblyComm< TData >::m_comm, Nektar::MultiRegions::AssemblyComm< TData >::m_gids_to_uids, Nektar::MultiRegions::AssemblyComm< TData >::m_rank, Nektar::MultiRegions::AssemblyComm< TData >::m_uid_to_index, Nektar::MultiRegions::AssemblyComm< TData >::m_uid_to_ranks, and Nektar::LibUtilities::ReduceSum.
|
inline |
Definition at line 233 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::m_fromRank.
|
inline |
Start of each entry's payload in the receive buffer; see GetSendOffsets().
Definition at line 228 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::m_recv_offsets.
|
inline |
Start of each entry's payload in the send buffer, with a final entry holding the total. Valid after InitSendRecvCommsVar().
Definition at line 221 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::m_send_offsets.
|
inline |
Definition at line 238 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries.
|
inline |
Definition at line 131 of file AssemblyComm.h.
References Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms(), Nektar::MultiRegions::AssemblyComm< TData >::m_recv_storage, Nektar::MultiRegions::AssemblyComm< TData >::m_send_storage, and Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms().
|
inline |
Definition at line 139 of file AssemblyComm.h.
References ASSERTL0, Nektar::MultiRegions::AssemblyComm< TData >::m_comm, Nektar::MultiRegions::AssemblyComm< TData >::m_recv_reqs, Nektar::MultiRegions::AssemblyComm< TData >::m_send_reqs, and Nektar::MultiRegions::AssemblyComm< TData >::m_sr_blocks.
|
inline |
Open persistent requests for payloads that differ in size from entry to entry.
| send_storage_ptr | Send buffer, laid out as the running sum of sendCounts. |
| sendCounts | Elements this rank sends for each entry, in GetSREntries() order. |
| recv_storage_ptr | Receive buffer, laid out as the running sum of recvCounts. |
| recvCounts | Elements this rank receives for each entry, in the same order. Equal to the neighbour's send count for the matching entry, which need not be this rank's - the two sides of a trace may carry different numbers of points. |
Definition at line 181 of file AssemblyComm.h.
References ASSERTL0, Nektar::MultiRegions::AssemblyComm< TData >::BuildOffsets(), Nektar::MultiRegions::AssemblyComm< TData >::m_comm, Nektar::MultiRegions::AssemblyComm< TData >::m_recv_offsets, Nektar::MultiRegions::AssemblyComm< TData >::m_recv_reqs, Nektar::MultiRegions::AssemblyComm< TData >::m_send_offsets, Nektar::MultiRegions::AssemblyComm< TData >::m_send_reqs, Nektar::MultiRegions::AssemblyComm< TData >::m_sr_blocks, and Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries.
|
private |
Definition at line 356 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::BeginComm(), Nektar::MultiRegions::AssemblyComm< TData >::DiscoverSharedIDsRing(), Nektar::MultiRegions::AssemblyComm< TData >::EndComm(), Nektar::MultiRegions::AssemblyComm< TData >::FillUniqueMap(), Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms(), and Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar().
|
private |
rank where assembled point has been communciated from
Definition at line 328 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm(), Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps(), and Nektar::MultiRegions::AssemblyComm< TData >::GetFromRank().
|
private |
List of local IDs, where each entry denotes a potential shared dof. 0 entry denotes local to this process, no communication required.
Definition at line 362 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps(), Nektar::MultiRegions::AssemblyComm< TData >::DiscoverSharedIDsRing(), and Nektar::MultiRegions::AssemblyComm< TData >::FillUniqueMap().
|
private |
Definition at line 357 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm(), Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm(), Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps(), Nektar::MultiRegions::AssemblyComm< TData >::DiscoverSharedIDsRing(), and Nektar::MultiRegions::AssemblyComm< TData >::FillUniqueMap().
|
private |
Definition at line 340 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::GetRecvOffsets(), and Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar().
|
private |
Recv requests.
Definition at line 354 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::BeginComm(), Nektar::MultiRegions::AssemblyComm< TData >::EndComm(), Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms(), and Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar().
|
private |
Recv storage if required.
Definition at line 334 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::EndAssemble(), and Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms().
|
private |
Running sums of the per-entry payload sizes, when those vary; see InitSendRecvCommsVar(). Both hold one more element than there are entries, the last being the buffer total.
Definition at line 339 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::GetSendOffsets(), and Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar().
|
private |
Send requests.
Definition at line 352 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::BeginComm(), Nektar::MultiRegions::AssemblyComm< TData >::EndComm(), Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms(), and Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar().
|
private |
Send storage if required.
Definition at line 332 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::BeginAssemble(), and Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms().
|
private |
Definition at line 358 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm(), Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm(), and Nektar::MultiRegions::AssemblyComm< TData >::DiscoverSharedIDsRing().
|
private |
Definition at line 329 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm(), Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps(), Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms(), and Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar().
|
private |
List of entries that map local indices to send/recv storage.
Definition at line 326 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm(), Nektar::MultiRegions::AssemblyComm< TData >::BeginAssemble(), Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps(), Nektar::MultiRegions::AssemblyComm< TData >::EndAssemble(), Nektar::MultiRegions::AssemblyComm< TData >::GetSREntries(), Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms(), and Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar().
|
private |
Map each ID to the index inside m_local_ids where it lives.
Definition at line 366 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps(), and Nektar::MultiRegions::AssemblyComm< TData >::FillUniqueMap().
|
private |
Map each ID to a vector of ranks that own this ID.
Definition at line 364 of file AssemblyComm.h.
Referenced by Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps(), Nektar::MultiRegions::AssemblyComm< TData >::DiscoverSharedIDsRing(), and Nektar::MultiRegions::AssemblyComm< TData >::FillUniqueMap().