Commit 5873cacc authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: adjust infoSwitch to report host subscription (related to #531)

- this compact form shows the subscription per host in the unsorted
  mpi order

      nProcs : 18
      Hosts  :
      (
          (node1 6)
          (node2 8)
          (node3 4)
      )

  This provides a succinct overview of which hosts have been
  subscribed or oversubscribed.

- The longer list of "slave.pid" ... remains available on the
  InfoSwitch 'writeHosts'
parent 5e7a2917
......@@ -38,21 +38,24 @@ InfoSwitches
// The default ASCII write precision
writePrecision 6;
// Enable job info
writeJobInfo 0;
writeDictionaries 0;
writeOptionalEntries 0;
// Write lagrangian "positions" file in v1706 format (at earlier)
writeLagrangianPositions 0;
// Report list of slaves/pids used (parallel)
writeSlaves 1;
// Report hosts used (parallel)
// - 0 = none
// - 1 = per-host-count, but unsorted
// - 2 = long output of "slave.pid" ...
writeHosts 1;
// Report list of roots used (parallel)
writeRoots 1;
// Enable job info
writeJobInfo 0;
// Allow profiling
allowProfiling 1;
......
......@@ -102,6 +102,53 @@ Foam::argList::initValidTables::initValidTables()
Foam::argList::initValidTables dummyInitValidTables;
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
namespace Foam
{
// Counted per machine name
// Does not include any sorting since we wish to know the ordering according to
// mpi rank.
//
// Always include the master too.
// This provides a better overview of the subscription
static void printHostsSubscription(const UList<string>& slaveProcs)
{
Info<< "Hosts :" << nl << "(" << nl;
std::string prev = hostName();
int count = 1;
for (const auto& str : slaveProcs)
{
const auto dot = str.rfind('.');
const std::string curr(std::move(str.substr(0, dot)));
if (prev != curr)
{
if (count)
{
// Finish previous
Info<<" (" << prev.c_str() << " " << count << ")" << nl;
count = 0;
}
prev = std::move(curr);
}
++count;
}
if (count)
{
// Finished last one
Info<<" (" << prev.c_str() << " " << count << ")" << nl;
}
Info<< ")" << nl;
}
}
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
......@@ -931,6 +978,7 @@ void Foam::argList::parse
}
stringList slaveProcs;
const int writeHostsSwitch = debug::infoSwitch("writeHosts", 1);
// Collect slave machine/pid, and check that the build is identical
if (parRunControl_.parRun())
......@@ -981,8 +1029,9 @@ void Foam::argList::parse
// Keep or discard slave and root information for reporting:
if (Pstream::master() && parRunControl_.parRun())
{
if (!debug::infoSwitch("writeSlaves", 1))
if (!writeHostsSwitch)
{
// Clear here to ensures it doesn't show in the jobInfo
slaveProcs.clear();
}
if (!debug::infoSwitch("writeRoots", 1))
......@@ -1000,7 +1049,16 @@ void Foam::argList::parse
{
if (slaveProcs.size())
{
Info<< "Slaves : " << slaveProcs << nl;
if (writeHostsSwitch == 1)
{
// Compact output (see etc/controlDict)
printHostsSubscription(slaveProcs);
}
else
{
// Full output of "slave.pid"
Info<< "Slaves : " << slaveProcs << nl;
}
}
if (roots.size())
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment