mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: extend globalIndex mpiGather to use scalar/label components
- MPI_Gatherv requires contiguous data, but a byte-wise transfer can quickly exceed the 'int' limits used for MPI sizes/offsets. Thus gather label/scalar components when possible to increase the effective size limit. For non-contiguous types (or large contiguous data) now also reverts to manual handling ENH: handle contiguous data in GAMGAgglomeration gather values - delegate to globalIndex::gatherValues static method (new)
This commit is contained in:
@ -68,6 +68,29 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// This now compiles (and works)
|
||||
// - reverts to normal gather for non-contiguous
|
||||
{
|
||||
const wordList sendData({"hello", "world"});
|
||||
|
||||
// One-sided sizing! master only
|
||||
const globalIndex allProcAddr
|
||||
(
|
||||
sendData.size(),
|
||||
globalIndex::gatherOnly{}
|
||||
);
|
||||
|
||||
Pout<< "listGather sizes: " << flatOutput(allProcAddr.sizes()) << nl;
|
||||
|
||||
// Collect all values
|
||||
wordList allValues
|
||||
(
|
||||
allProcAddr.mpiGather(sendData)
|
||||
);
|
||||
|
||||
Pout<< "all-data: " << allValues << endl;
|
||||
}
|
||||
|
||||
// Gather all values
|
||||
{
|
||||
const auto& sendData = localValues;
|
||||
@ -75,8 +98,8 @@ int main(int argc, char *argv[])
|
||||
// One-sided sizing! master only
|
||||
const globalIndex allProcAddr
|
||||
(
|
||||
UPstream::listGatherValues<label>(sendData.size()),
|
||||
globalIndex::SIZES
|
||||
sendData.size(),
|
||||
globalIndex::gatherOnly{}
|
||||
);
|
||||
|
||||
Pout<< "listGather sizes: " << flatOutput(allProcAddr.sizes()) << nl;
|
||||
|
||||
Reference in New Issue
Block a user