ENH: bundle broadcasts (#2371)

- additional Pstream::broadcasts() method to serialize/deserialize
  multiple items.

- revoke the broadcast specialisations for std::string and List(s) and
  use a generic broadcasting template. In most cases, the previous
  specialisations would have required two broadcasts:
    (1) for the size
    (2) for the contiguous content.

  Now favour reduced communication over potential local (intermediate)
  storage that would have only benefited a few select cases.

ENH: refine PstreamBuffers access methods

- replace 'bool hasRecvData(label)' with 'label recvDataCount(label)'
  to recover the number of unconsumed receive bytes from specified
  processor.  Can use 'labelList recvDataCounts()' to recover the
  number of unconsumed receive bytes from all processor.

- additional peekRecvData() method (for transcribing contiguous data)

ENH: globalIndex whichProcID - check for isLocal first

- reasonable to assume that local items are searched for more
  frequently, so do preliminary check for isLocal before performing
  a more costly binary search of globalIndex offsets

ENH: masterUncollatedFileOperation - bundled scatter of status
This commit is contained in:
Mark Olesen
2022-04-02 14:02:54 +02:00
parent a27af5e369
commit 18e0d7e4d6
40 changed files with 486 additions and 440 deletions

View File

@ -211,8 +211,8 @@ int main(int argc, char *argv[])
label proci = globalFaces.whichProcID(unsetFacei);
label seedFacei = globalFaces.toLocal(proci, unsetFacei);
Info<< "Seeding from processor " << proci << " face " << seedFacei
<< endl;
Info<< "Seeding from processor " << proci
<< " face " << seedFacei << endl;
if (proci == Pstream::myProcNo())
{

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -516,12 +516,15 @@ void getInterfaceSizes
}
// Now all processor have consistent interface information
Pstream::scatter(interfaces);
Pstream::scatter(interfaceNames);
Pstream::scatter(interfaceSizes);
Pstream::scatter(regionsToInterface);
// Consistent interface information for all processors
Pstream::broadcasts
(
UPstream::worldComm,
interfaces,
interfaceNames,
interfaceSizes,
regionsToInterface
);
// Mark all inter-region faces.
faceToInterface.setSize(mesh.nFaces(), -1);

View File

@ -441,7 +441,7 @@ int main(int argc, char *argv[])
{
files = getFiles(args.path(), timeName);
}
Pstream::scatter(files);
Pstream::broadcast(files);
count += restoreFields
(

View File

@ -208,9 +208,9 @@ Foam::parLagrangianRedistributor::redistributeLagrangianPositions
for (const int proci : pBufs.allProcs())
{
//Pout<< "Receive from processor" << proci << " : "
// << pBufs.hasRecvData(proci) << endl;
// << pBufs.recvDataCount(proci) << endl;
if (pBufs.hasRecvData(proci))
if (pBufs.recvDataCount(proci))
{
UIPstream particleStream(proci, pBufs);