diff --git a/applications/test/parallel-comm2/Test-parallel-comm2.C b/applications/test/parallel-comm2/Test-parallel-comm2.C index b5f01bc504..8ed7684fc2 100644 --- a/applications/test/parallel-comm2/Test-parallel-comm2.C +++ b/applications/test/parallel-comm2/Test-parallel-comm2.C @@ -85,7 +85,8 @@ int main(int argc, char *argv[]) if (UPstream::parRun() && optPrintTree) { - Info<< "comms: " << UPstream::whichCommunication() << endl; + Info<< "comms: " + << UPstream::whichCommunication(UPstream::worldComm) << nl; UPstream::printCommTree(UPstream::commWorld()); } diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C index cd2e1d3c84..96abceea74 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.C @@ -58,6 +58,58 @@ Foam::UPstream::commsTypeNames }); +// * * * * * * * * * * * * * Controls Information * * * * * * * * * * * * * // + +void Foam::UPstream::printNodeCommsControl(Ostream& os) +{ + if (UPstream::nodeCommsControl_ > 0) + { + if (UPstream::usingNodeComms(UPstream::worldComm)) + { + os << "on ["; + } + else + { + os << "off ["; + } + if (UPstream::nodeCommsMin_ > 2) + { + os << "min=" << UPstream::nodeCommsMin_ << ","; + } + os << "type="; + + // 1: split by hostname [default] + // 2: split by shared + // >=4: (debug/manual) split with given number per node + if (UPstream::nodeCommsControl_ >= 4) + { + os << UPstream::nodeCommsControl_; + } + else if (UPstream::nodeCommsControl_ == 2) + { + os << "shared"; + } + else + { + os << "host"; + } + os << "]"; + } + else + { + os << "disabled"; + } + os << " (" << UPstream::nProcs(UPstream::worldComm) << " ranks, " + << UPstream::numNodes() << " nodes)"; +} + + +void Foam::UPstream::printTopoControl(Ostream& os) +{ + os << "none"; +} + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::UPstream::setParRun(const label nProcs, const bool haveThreads) @@ -789,6 +841,17 @@ registerOptSwitch ); +int Foam::UPstream::topologyControl_ +( + Foam::debug::optimisationSwitch("topoControl", 0) +); +registerOptSwitch +( + "topoControl", + int, + Foam::UPstream::topologyControl_ +); + bool Foam::UPstream::floatTransfer ( Foam::debug::optimisationSwitch("floatTransfer", 0) diff --git a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H index a49db6dd8a..1e9d0f21eb 100644 --- a/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H +++ b/src/OpenFOAM/db/IOstreams/Pstreams/UPstream.H @@ -404,6 +404,15 @@ public: // >= 3 : when there are more than N nodes static int nodeCommsMin_; + //- Selection of topology-aware routines + static int topologyControl_; + + //- Test for selection of given topology-aware routine (bitmask) + static bool usingTopoControl(int routine = 0) noexcept + { + return static_cast(topologyControl_ & routine); + } + //- Should compact transfer be used in which floats replace doubles //- reducing the bandwidth requirement at the expense of some loss //- in accuracy @@ -757,6 +766,15 @@ public: ); + // Information + + //- Report the node-communication settings + static void printNodeCommsControl(Ostream& os); + + //- Report the topology routines settings + static void printTopoControl(Ostream& os); + + // Requests (non-blocking comms). // Pending requests are usually handled as an internal (global) list, // since this simplifies the overall tracking and provides a convenient diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 99bee6f6fd..d04c26860a 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -2094,21 +2094,17 @@ void Foam::argList::parse } } - Info<< "Pstream initialized with:" << nl - << " node communication : "; - if (UPstream::nodeCommsControl_ > 0) + Info<< "Pstream initialized with:" << nl; { - Info<< Switch::name(UPstream::usingNodeComms()) - << " [min=" << UPstream::nodeCommsMin_ - << ", type=" << UPstream::nodeCommsControl_ - << "]"; + Info<< " node communication : "; + UPstream::printNodeCommsControl(Info); + Info<< nl; } - else { - Info<< "disabled"; + Info<< " topology controls : "; + UPstream::printTopoControl(Info); + Info<< nl; } - Info<< " (" << UPstream::nProcs() << " ranks, " - << UPstream::numNodes() << " nodes)" << nl; if (UPstream::floatTransfer) { @@ -2128,7 +2124,7 @@ void Foam::argList::parse const auto& commsType = UPstream::commsTypeNames[UPstream::defaultCommsType]; - Info<< " nonBlockingExchange: " + Info<< " consensus exchange : " << UPstream::nProcsNonblockingExchange << " (tuning: " << UPstream::tuning_NBX_ << ')' << nl << " exchange algorithm : "