Nektar++
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Nektar::MultiRegions::AssemblyComm< TData > Class Template Reference

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.
 

Detailed Description

template<typename TData>
class Nektar::MultiRegions::AssemblyComm< TData >

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.

Fixed and variable payloads

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.

Constructor & Destructor Documentation

◆ AssemblyComm() [1/2]

template<typename TData >
Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm ( LibUtilities::CommSharedPtr  comm,
const Array< OneD, long > &  gids_to_uids 
)
inline

Definition at line 80 of file AssemblyComm.h.

82 : m_comm(comm), m_gids_to_uids(gids_to_uids)
83 {
84 m_rank = comm->GetRank();
85 m_size = comm->GetSize();
86
89 }
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 pro...
LibUtilities::CommSharedPtr m_comm

References Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps(), Nektar::MultiRegions::AssemblyComm< TData >::DiscoverSharedIDsRing(), Nektar::MultiRegions::AssemblyComm< TData >::m_rank, and Nektar::MultiRegions::AssemblyComm< TData >::m_size.

◆ AssemblyComm() [2/2]

template<typename TData >
Nektar::MultiRegions::AssemblyComm< TData >::AssemblyComm ( LibUtilities::CommSharedPtr  comm,
const std::map< int, std::vector< size_t > > &  sharedEntries 
)
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.

Parameters
commCommunicator to exchange over.
sharedEntriesLocal 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.

111 : m_comm(comm)
112 {
113 m_rank = comm->GetRank();
114 m_size = comm->GetSize();
115
116 size_t offset = 0;
117 for (const auto &[rank, entries] : sharedEntries)
118 {
119 m_sr_blocks.push_back({rank, offset, entries.size()});
120
121 for (auto idx : entries)
122 {
123 m_sr_entries.push_back(idx);
124 m_fromRank.push_back(rank);
125 }
126
127 offset += entries.size();
128 }
129 }
std::vector< SendRecvBlock > m_sr_blocks
std::vector< unsigned > m_fromRank
rank where assembled point has been communciated from
std::vector< size_t > m_sr_entries
List of entries that map local indices to send/recv storage.

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.

Member Function Documentation

◆ BeginAssemble()

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::BeginAssemble ( const Array< OneD, TData > &  values)
inline

Definition at line 277 of file AssemblyComm.h.

278 {
279 // Fill send buffer
280 for (size_t i = 0; i < m_sr_entries.size(); ++i)
281 {
282 m_send_storage[i] = values[m_sr_entries[i]];
283 }
284
285 BeginComm();
286 }
std::vector< TData > m_send_storage
Send storage if required.

References Nektar::MultiRegions::AssemblyComm< TData >::BeginComm(), Nektar::MultiRegions::AssemblyComm< TData >::m_send_storage, and Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries.

◆ BeginComm()

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::BeginComm ( )
inline

Definition at line 243 of file AssemblyComm.h.

244 {
245 ASSERTL1(
247 "InitSendRecvComm() must be called before BeginComm can be used");
248 // Post receives
249 m_comm->StartAll(m_recv_reqs);
250
251 // Post sends
252 m_comm->StartAll(m_send_reqs);
253 }
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode....
LibUtilities::CommRequestSharedPtr m_recv_reqs
Recv requests.
LibUtilities::CommRequestSharedPtr m_send_reqs
Send requests.

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().

◆ BuildOffsets()

template<typename TData >
static void Nektar::MultiRegions::AssemblyComm< TData >::BuildOffsets ( const std::vector< size_t > &  counts,
std::vector< size_t > &  offsets 
)
inlinestaticprivate

Turn per-entry counts into the running sum the buffers are laid out by.

Definition at line 343 of file AssemblyComm.h.

345 {
346 offsets.resize(counts.size() + 1);
347 offsets[0] = 0;
348 std::partial_sum(counts.begin(), counts.end(), offsets.begin() + 1);
349 }

Referenced by Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar().

◆ BuildSendRecvMaps()

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::BuildSendRecvMaps ( )
inlineprivate

Definition at line 456 of file AssemblyComm.h.

457 {
458 // Set up map of local IDs -> location inside m_local_ids
459 for (size_t i = 0; i < m_gids_to_uids.size(); ++i)
460 {
461 if (m_gids_to_uids[i] == 0)
462 {
463 continue;
464 }
465
467 }
468
469 // Map that takes ranks to entries to send/receive. Basically the
470 // inverse of m_uid_to_ranks.
471 std::unordered_map<int, std::vector<size_t>> sr_map;
472
473 for (const auto &[uid, ranks] : m_uid_to_ranks)
474 {
475 // Loop over ranks, and sort out list of IDs to send/receive
476 for (int r : ranks)
477 {
478 if (r == m_rank)
479 {
480 continue;
481 }
482
483 sr_map[r].push_back(uid);
484 }
485 }
486
487 // Flatten send/recv blocks and create entries
488 size_t offset = 0;
489 for (auto &[rank, indices] : sr_map)
490 {
491 // Create a block that will eventually be sent to each rank from
492 // within the send/receive storage.
493 m_sr_blocks.push_back({rank, offset, indices.size()});
494
495 // Sort indices to ensure same send/recv order for IDs, otherwise we
496 // will mismatch.
497 std::sort(indices.begin(), indices.end());
498
499 // Note this is by reference to change the ultimate entry inside
500 // indices
501 for (auto &idx : indices)
502 {
503 idx = m_uid_to_index[idx];
504 m_sr_entries.push_back(idx);
505 m_fromRank.push_back(rank);
506 }
507
508 offset += indices.size();
509 }
510 }
std::unordered_map< long, size_t > m_uid_to_index
Map each ID to the index inside m_local_ids where it lives.
std::unordered_map< long, std::vector< int > > m_uid_to_ranks
Map each ID to a vector of ranks that own this ID.

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().

◆ DiscoverSharedIDsRing()

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::DiscoverSharedIDsRing ( )
inlineprivate

Definition at line 368 of file AssemblyComm.h.

369 {
370 // Create a set of IDs that lie on this process for fast ID lookups
371 std::unordered_set<long> gid_to_uid_set(m_gids_to_uids.begin(),
372 m_gids_to_uids.end());
373
374 int nNonZero = 0;
375
376 for (auto uid : m_gids_to_uids)
377 {
378 // Zero IDs are masked out from communication
379 if (uid == 0)
380 {
381 continue;
382 }
383
384 // always shared with self
385 m_uid_to_ranks[uid].push_back(m_rank);
386
387 // count number of non-zero entries in m_local_ids
388 nNonZero++;
389 }
390
391 Array<OneD, long> send_uids(nNonZero), recv_uids;
392
393 // Isolate all non-zero ids
394 for (size_t cnt = 0, i = 0; i < m_gids_to_uids.size(); ++i)
395 {
396 if (m_gids_to_uids[i] == 0)
397 {
398 continue;
399 }
400
401 send_uids[cnt++] = m_gids_to_uids[i];
402 }
403
404 // Ring communication: send IDs in an all-to-all but without O(n)
405 // storage cost.
406 for (int k = 1; k < m_size; ++k)
407 {
408 int send_rank = (m_rank + k) % m_size;
409 int recv_rank = (m_rank - k + m_size) % m_size;
410
411 // How many dofs do we need to send/receive?
412 int send_count = send_uids.size();
413 int recv_count = 0;
414
415 // Communicate number of entries to send/receive
416 m_comm->SendRecv(send_rank, send_count, recv_rank, recv_count);
417 recv_uids = Array<OneD, long>(recv_count);
418
419 // Do the actual send/receive
420 m_comm->SendRecv(send_rank, send_uids, recv_rank, recv_uids);
421
422 for (long uid : recv_uids)
423 {
424 if (gid_to_uid_set.find(uid) != gid_to_uid_set.end())
425 {
426 m_uid_to_ranks[uid].push_back(recv_rank);
427 }
428 }
429 }
430
431 // Deduplicate, so that rank list is unique for each ID
432 for (auto &[uid, ranks] : m_uid_to_ranks)
433 {
434 std::sort(ranks.begin(), ranks.end());
435 ranks.erase(std::unique(ranks.begin(), ranks.end()), ranks.end());
436 }
437
438#if 0
439 // debug print
440 for (auto &[uid, ranks] : m_uid_to_ranks)
441 {
442 if (ranks.size() == 1)
443 {
444 continue;
445 }
446 std::cout << "[RANK " << m_rank << "]: uid " << uid << " ->";
447 for (auto &rank : ranks)
448 {
449 std::cout << " " << rank;
450 }
451 std::cout << std::endl;
452 }
453#endif
454 }

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().

◆ EndAssemble()

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::EndAssemble ( Array< OneD, TData > &  values)
inline

Definition at line 266 of file AssemblyComm.h.

267 {
268 EndComm();
269
270 // Accumulate
271 for (size_t i = 0; i < m_sr_entries.size(); ++i)
272 {
273 values[m_sr_entries[i]] += m_recv_storage[i];
274 }
275 }
std::vector< TData > m_recv_storage
Recv storage if required.

References Nektar::MultiRegions::AssemblyComm< TData >::EndComm(), Nektar::MultiRegions::AssemblyComm< TData >::m_recv_storage, and Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries.

◆ EndComm()

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::EndComm ( )
inline

Definition at line 255 of file AssemblyComm.h.

256 {
257 ASSERTL1(
259 "InitSendRecvComm() must be called before BeginComm can be used");
260
261 // Wait for send-recv to finish
262 m_comm->WaitAll(m_send_reqs);
263 m_comm->WaitAll(m_recv_reqs);
264 }

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().

◆ FillUniqueMap()

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::FillUniqueMap ( Array< OneD, long > &  unique)
inline

Definition at line 288 of file AssemblyComm.h.

289 {
290 ASSERTL0(unique.size() == m_gids_to_uids.size(), "wut");
291
292 int nShared = 0;
293
294 // Mask out entries we do not own
295 for (const auto &[uid, ranks] : m_uid_to_ranks)
296 {
297 // Disregard any uids we solely own
298 if (ranks.size() == 1)
299 {
300 continue;
301 }
302
303 int owner = *std::min_element(ranks.begin(), ranks.end());
304 if (owner == m_rank)
305 {
306 nShared++;
307 }
308 else
309 {
310 auto idx = m_uid_to_index[uid];
311 unique[idx] = -unique[idx];
312 }
313 }
314 m_comm->AllReduce(nShared, LibUtilities::ReduceSum);
315 }
#define ASSERTL0(condition, msg)

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.

◆ GetFromRank()

template<typename TData >
const std::vector< unsigned > & Nektar::MultiRegions::AssemblyComm< TData >::GetFromRank ( ) const
inline

Definition at line 233 of file AssemblyComm.h.

234 {
235 return m_fromRank;
236 }

References Nektar::MultiRegions::AssemblyComm< TData >::m_fromRank.

◆ GetRecvOffsets()

template<typename TData >
const std::vector< size_t > & Nektar::MultiRegions::AssemblyComm< TData >::GetRecvOffsets ( ) const
inline

Start of each entry's payload in the receive buffer; see GetSendOffsets().

Definition at line 228 of file AssemblyComm.h.

229 {
230 return m_recv_offsets;
231 }
std::vector< size_t > m_recv_offsets

References Nektar::MultiRegions::AssemblyComm< TData >::m_recv_offsets.

◆ GetSendOffsets()

template<typename TData >
const std::vector< size_t > & Nektar::MultiRegions::AssemblyComm< TData >::GetSendOffsets ( ) const
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.

222 {
223 return m_send_offsets;
224 }
std::vector< size_t > m_send_offsets
Running sums of the per-entry payload sizes, when those vary; see InitSendRecvCommsVar()....

References Nektar::MultiRegions::AssemblyComm< TData >::m_send_offsets.

◆ GetSREntries()

template<typename TData >
const std::vector< size_t > & Nektar::MultiRegions::AssemblyComm< TData >::GetSREntries ( ) const
inline

Definition at line 238 of file AssemblyComm.h.

239 {
240 return m_sr_entries;
241 }

References Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries.

◆ InitSendRecvComms() [1/2]

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms ( )
inline

◆ InitSendRecvComms() [2/2]

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvComms ( const unsigned  nstorage,
TData *  send_storage_ptr,
TData *  recv_storage_ptr,
const unsigned  numComp = 1 
)
inline

Definition at line 139 of file AssemblyComm.h.

141 {
142 ASSERTL0(nstorage >= m_sr_blocks.size() * numComp,
143 "Pointer size is not sufficent for send recieve storage");
144
145 // Create send/recv requests
146 m_send_reqs = m_comm->CreateRequest(m_sr_blocks.size());
147 m_recv_reqs = m_comm->CreateRequest(m_sr_blocks.size());
148
149 int reqCnt = 0;
150 for (const auto &block : m_sr_blocks)
151 {
152 CommPtrView<TData> send_ptr(send_storage_ptr +
153 block.offset * numComp,
154 block.count * numComp);
155 CommPtrView<TData> recv_ptr(recv_storage_ptr +
156 block.offset * numComp,
157 block.count * numComp);
158 m_comm->SendInit(block.rank, send_ptr, block.count * numComp,
159 m_send_reqs, reqCnt);
160 m_comm->RecvInit(block.rank, recv_ptr, block.count * numComp,
161 m_recv_reqs, reqCnt++);
162 }
163 }

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.

◆ InitSendRecvCommsVar()

template<typename TData >
void Nektar::MultiRegions::AssemblyComm< TData >::InitSendRecvCommsVar ( TData *  send_storage_ptr,
const std::vector< size_t > &  sendCounts,
TData *  recv_storage_ptr,
const std::vector< size_t > &  recvCounts 
)
inline

Open persistent requests for payloads that differ in size from entry to entry.

Parameters
send_storage_ptrSend buffer, laid out as the running sum of sendCounts.
sendCountsElements this rank sends for each entry, in GetSREntries() order.
recv_storage_ptrReceive buffer, laid out as the running sum of recvCounts.
recvCountsElements 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.

185 {
186 ASSERTL0(sendCounts.size() == m_sr_entries.size() &&
187 recvCounts.size() == m_sr_entries.size(),
188 "One send and one receive count is needed per shared entry");
189
190 BuildOffsets(sendCounts, m_send_offsets);
191 BuildOffsets(recvCounts, m_recv_offsets);
192
193 m_send_reqs = m_comm->CreateRequest(m_sr_blocks.size());
194 m_recv_reqs = m_comm->CreateRequest(m_sr_blocks.size());
195
196 int reqCnt = 0;
197 for (const auto &block : m_sr_blocks)
198 {
199 // A block's entries are contiguous in GetSREntries(), so its
200 // payload is contiguous in the buffer too, and one message
201 // carries the whole block however its entries are sized.
202 const size_t sendBeg = m_send_offsets[block.offset];
203 const size_t sendEnd = m_send_offsets[block.offset + block.count];
204 const size_t recvBeg = m_recv_offsets[block.offset];
205 const size_t recvEnd = m_recv_offsets[block.offset + block.count];
206
207 CommPtrView<TData> send_ptr(send_storage_ptr + sendBeg,
208 sendEnd - sendBeg);
209 CommPtrView<TData> recv_ptr(recv_storage_ptr + recvBeg,
210 recvEnd - recvBeg);
211
212 m_comm->SendInit(block.rank, send_ptr, sendEnd - sendBeg,
213 m_send_reqs, reqCnt);
214 m_comm->RecvInit(block.rank, recv_ptr, recvEnd - recvBeg,
215 m_recv_reqs, reqCnt++);
216 }
217 }
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.

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.

Member Data Documentation

◆ m_comm

template<typename TData >
LibUtilities::CommSharedPtr Nektar::MultiRegions::AssemblyComm< TData >::m_comm
private

◆ m_fromRank

template<typename TData >
std::vector<unsigned> Nektar::MultiRegions::AssemblyComm< TData >::m_fromRank
private

◆ m_gids_to_uids

template<typename TData >
Array<OneD, long> Nektar::MultiRegions::AssemblyComm< TData >::m_gids_to_uids
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().

◆ m_rank

template<typename TData >
unsigned Nektar::MultiRegions::AssemblyComm< TData >::m_rank
private

◆ m_recv_offsets

template<typename TData >
std::vector<size_t> Nektar::MultiRegions::AssemblyComm< TData >::m_recv_offsets
private

◆ m_recv_reqs

template<typename TData >
LibUtilities::CommRequestSharedPtr Nektar::MultiRegions::AssemblyComm< TData >::m_recv_reqs = nullptr
private

◆ m_recv_storage

template<typename TData >
std::vector<TData> Nektar::MultiRegions::AssemblyComm< TData >::m_recv_storage
private

◆ m_send_offsets

template<typename TData >
std::vector<size_t> Nektar::MultiRegions::AssemblyComm< TData >::m_send_offsets
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().

◆ m_send_reqs

template<typename TData >
LibUtilities::CommRequestSharedPtr Nektar::MultiRegions::AssemblyComm< TData >::m_send_reqs = nullptr
private

◆ m_send_storage

template<typename TData >
std::vector<TData> Nektar::MultiRegions::AssemblyComm< TData >::m_send_storage
private

◆ m_size

template<typename TData >
unsigned Nektar::MultiRegions::AssemblyComm< TData >::m_size
private

◆ m_sr_blocks

template<typename TData >
std::vector<SendRecvBlock> Nektar::MultiRegions::AssemblyComm< TData >::m_sr_blocks
private

◆ m_sr_entries

template<typename TData >
std::vector<size_t> Nektar::MultiRegions::AssemblyComm< TData >::m_sr_entries
private

◆ m_uid_to_index

template<typename TData >
std::unordered_map<long, size_t> Nektar::MultiRegions::AssemblyComm< TData >::m_uid_to_index
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().

◆ m_uid_to_ranks

template<typename TData >
std::unordered_map<long, std::vector<int> > Nektar::MultiRegions::AssemblyComm< TData >::m_uid_to_ranks
private