mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -38,21 +38,24 @@ InfoSwitches
|
|||||||
// The default ASCII write precision
|
// The default ASCII write precision
|
||||||
writePrecision 6;
|
writePrecision 6;
|
||||||
|
|
||||||
// Enable job info
|
|
||||||
writeJobInfo 0;
|
|
||||||
|
|
||||||
writeDictionaries 0;
|
writeDictionaries 0;
|
||||||
writeOptionalEntries 0;
|
writeOptionalEntries 0;
|
||||||
|
|
||||||
// Write lagrangian "positions" file in v1706 format (at earlier)
|
// Write lagrangian "positions" file in v1706 format (at earlier)
|
||||||
writeLagrangianPositions 0;
|
writeLagrangianPositions 0;
|
||||||
|
|
||||||
// Report list of slaves/pids used (parallel)
|
// Report hosts used (parallel)
|
||||||
writeSlaves 1;
|
// - 0 = none
|
||||||
|
// - 1 = per-host-count, but unsorted
|
||||||
|
// - 2 = long output of "slave.pid" ...
|
||||||
|
writeHosts 1;
|
||||||
|
|
||||||
// Report list of roots used (parallel)
|
// Report list of roots used (parallel)
|
||||||
writeRoots 1;
|
writeRoots 1;
|
||||||
|
|
||||||
|
// Enable job info
|
||||||
|
writeJobInfo 0;
|
||||||
|
|
||||||
// Allow profiling
|
// Allow profiling
|
||||||
allowProfiling 1;
|
allowProfiling 1;
|
||||||
|
|
||||||
|
|||||||
@ -102,6 +102,53 @@ Foam::argList::initValidTables::initValidTables()
|
|||||||
|
|
||||||
Foam::argList::initValidTables dummyInitValidTables;
|
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 * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -931,6 +978,7 @@ void Foam::argList::parse
|
|||||||
}
|
}
|
||||||
|
|
||||||
stringList slaveProcs;
|
stringList slaveProcs;
|
||||||
|
const int writeHostsSwitch = debug::infoSwitch("writeHosts", 1);
|
||||||
|
|
||||||
// Collect slave machine/pid, and check that the build is identical
|
// Collect slave machine/pid, and check that the build is identical
|
||||||
if (parRunControl_.parRun())
|
if (parRunControl_.parRun())
|
||||||
@ -981,8 +1029,9 @@ void Foam::argList::parse
|
|||||||
// Keep or discard slave and root information for reporting:
|
// Keep or discard slave and root information for reporting:
|
||||||
if (Pstream::master() && parRunControl_.parRun())
|
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();
|
slaveProcs.clear();
|
||||||
}
|
}
|
||||||
if (!debug::infoSwitch("writeRoots", 1))
|
if (!debug::infoSwitch("writeRoots", 1))
|
||||||
@ -1000,7 +1049,16 @@ void Foam::argList::parse
|
|||||||
{
|
{
|
||||||
if (slaveProcs.size())
|
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())
|
if (roots.size())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user