From 6fa23bd7a697f15ba230a14e03b08b840c4d11fe Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 28 Mar 2022 14:03:05 +0200 Subject: [PATCH] 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) --- .../test/gatherValues1/Test-gatherValues1.C | 27 +- .../GAMGAgglomerateLduAddressing.C | 106 +-- .../GAMGAgglomeration/GAMGAgglomeration.H | 18 +- .../GAMGAgglomerationTemplates.C | 61 +- .../parallel/globalIndex/globalIndex.H | 735 +++++++++--------- .../globalIndex/globalIndexTemplates.C | 400 +++++++--- 6 files changed, 731 insertions(+), 616 deletions(-) diff --git a/applications/test/gatherValues1/Test-gatherValues1.C b/applications/test/gatherValues1/Test-gatherValues1.C index 7fdbf92bf3..773e1b9d25 100644 --- a/applications/test/gatherValues1/Test-gatherValues1.C +++ b/applications/test/gatherValues1/Test-gatherValues1.C @@ -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