BUG: globalIndex fails non-blocking gather of indirect list (fixes #2467)

- for indirect lists we use element-wise output streaming and read
  back as a regular list. This approach cannot however work with
  non-blocking mode - the receive buffers will simply not be filled
  before attempting to read from them.

  For contiguous data, the lowest overhead solution is to locally
  flatten the indirect list and use the regular gather routines
  for non-blocking mode. For non-contiguous data, can continue to
  use the element-wise output, but cannot use non-blocking for it.

STYLE: use non-blocking consistently as default for globalIndex gather(s)

- most of the front-facing code was already using non-blocking,
  but there were a few low-level routines defaulting to scheduled
  (but never relied upon in the code).
This commit is contained in:
Mark Olesen 2022-05-12 11:17:07 +02:00
parent 809fc70166
commit 812f4c4f09
2 changed files with 20 additions and 2 deletions

View File

@ -421,7 +421,7 @@ public:
const Type& localValue,
List<Type>& allValues, //! output field (master only)
const int tag = UPstream::msgType(),
const UPstream::commsTypes = UPstream::commsTypes::scheduled
const UPstream::commsTypes = UPstream::commsTypes::nonBlocking
);
//- Collect data in processor order on master (== procIDs[0]).
@ -449,7 +449,7 @@ public:
const IndirectListBase<Type, Addr>& fld,
List<Type>& allFld, //! output field (master only)
const int tag = UPstream::msgType(),
const UPstream::commsTypes = UPstream::commsTypes::scheduled
const UPstream::commsTypes = UPstream::commsTypes::nonBlocking
);

View File

@ -262,6 +262,24 @@ void Foam::globalIndex::gather
{
// low-level: no parRun guard
if (is_contiguous<Type>::value)
{
// Flatten list (locally) so that we can benefit from using direct
// read/write of contiguous data
gather
(
off,
comm,
procIDs,
List<Type>(fld),
allFld,
tag,
preferredCommsType
);
return;
}
// Automatically change from nonBlocking to scheduled for
// non-contiguous data.
const UPstream::commsTypes commsType =