From db871856c0d9b8069931be242bf32b3349300bdc Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Mon, 17 Mar 2025 15:54:40 +0100 Subject: [PATCH] CONFIG: add named topoControls --- etc/controlDict | 9 ++++++ src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C | 30 ++++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/etc/controlDict b/etc/controlDict index 855d06fbd72..74d85e59017 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -147,6 +147,15 @@ OptimisationSwitches // >= 3 : when there are more than N nodes nodeComms.min 0; + // Selection of topology-aware routines (bitmask) + // 0: disabled [default] + // 1: broadcast [MPI] + // 4: gather/all-gather [MPI] + // 16: combine (reduction) [manual algorithm] + // 32: mapGather (reduction) [manual algorithm] + // 64: gatherList/scatterList [manual algorithm] + topoControl 0; + // Transfer double as float for processor boundaries. Mostly defunct. floatTransfer 0; diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C index 2c1d72b143a..8bd92833829 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C @@ -106,7 +106,35 @@ void Foam::UPstream::printNodeCommsControl(Ostream& os) void Foam::UPstream::printTopoControl(Ostream& os) { - os << "none"; + unsigned count = 0; + + if (UPstream::topologyControl_ > 0) + { + #undef PrintControl + #define PrintControl(Ctrl, Name) \ + if (UPstream::usingTopoControl(topoControls::Ctrl)) \ + { \ + os << (count++ ? ' ' : '(') << Name; \ + } + + PrintControl(broadcast, "broadcast"); + PrintControl(reduce, "reduce"); + PrintControl(gather, "gather"); + PrintControl(combine, "combine"); + PrintControl(mapGather, "mapGather"); + PrintControl(gatherList, "gatherList"); + + #undef PrintControl + } + + if (count) + { + os << ')'; // End the list + } + else + { + os << "none"; + } } -- GitLab