mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Pstream::exchange with Map<Container> data
- dynamic sparse data exchange using Map to hold data and sizes. Still uses the personalised exchange paradigm, but with non-blocking consensus exchange to obtain the sizes and regular point-to-point for the data exchange itself. This avoids an all-to-all but still keeps the point-to-point for overlapping communication, data chunking etc.
This commit is contained in:
@ -32,6 +32,8 @@ Description
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#define Foam_PstreamExchange_debug_chunks
|
||||
|
||||
#include "List.H"
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
@ -371,6 +373,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Manually
|
||||
Info<< "perform list exchange" << endl;
|
||||
{
|
||||
labelListList sendBufs(UPstream::nProcs());
|
||||
labelListList recvBufs(UPstream::nProcs());
|
||||
@ -397,6 +400,34 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Info<< "perform Map exchange" << endl;
|
||||
{
|
||||
Map<labelList> sendBufs;
|
||||
Map<labelList> recvBufs;
|
||||
Map<label> recvSizes;
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
for (const int proci : Pstream::allProcs())
|
||||
{
|
||||
if (proci != Pstream::myProcNo())
|
||||
{
|
||||
sendBufs(proci) = identity(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pstream::exchangeSizes(sendBufs, recvSizes);
|
||||
|
||||
Pstream::exchange<labelList, label>
|
||||
(
|
||||
sendBufs,
|
||||
recvSizes,
|
||||
recvBufs
|
||||
);
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user