Merge branch 'feature-argList-report-host-subscription' into 'develop'
ENH: adjust infoSwitch to report host subscription (related to #531) See merge request Development/OpenFOAM-plus!150
This commit is contained in:
commit
8ae5b67a65
@ -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())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user