ENH: parProfiling: do not print on exit. Fixes #1298.

This commit is contained in:
mattijs
2019-05-15 08:30:06 +01:00
committed by Andrew Heather
parent 51f501b668
commit c46fe63b97
3 changed files with 25 additions and 20 deletions

View File

@ -183,28 +183,19 @@ void Foam::functionObjects::parProfiling::report()
const statData& allToAllStats = times[1]; const statData& allToAllStats = times[1];
scalar reduceAvg = reduceStats[2].second()/Pstream::nProcs(); scalar reduceAvg = reduceStats[2].second()/Pstream::nProcs();
scalar reduceRelMin =
(reduceStats[0].second()-reduceAvg)/(reduceAvg + VSMALL);
scalar reduceRelMax =
(reduceStats[1].second()-reduceAvg)/(reduceAvg + VSMALL);
scalar allToAllAvg = allToAllStats[2].second()/Pstream::nProcs(); scalar allToAllAvg = allToAllStats[2].second()/Pstream::nProcs();
scalar allToAllRelMin =
(allToAllStats[0].second()-allToAllAvg)/(allToAllAvg + VSMALL);
scalar allToAllRelMax =
(allToAllStats[1].second()-allToAllAvg)/(allToAllAvg + VSMALL);
Info<< type() << ':' << nl Info<< type() << ':' << nl
<< "\treduce : avg = " << reduceAvg << 's' << nl << "\treduce : avg = " << reduceAvg << 's' << nl
<< "\t min = " << reduceRelMin*100 << "\t min = " << reduceStats[0].second()
<< "% (processor " << reduceStats[0].first() << ')' << nl << "s (processor " << reduceStats[0].first() << ')' << nl
<< "\t max = +" << reduceRelMax*100 << "\t max = " << reduceStats[1].second()
<< "% (processor " << reduceStats[1].first() << ')' << nl << "s (processor " << reduceStats[1].first() << ')' << nl
<< "\tall-all : avg = " << allToAllAvg << 's' << nl << "\tall-all : avg = " << allToAllAvg << 's' << nl
<< "\t min = " << allToAllRelMin*100 << "\t min = " << allToAllStats[0].second()
<< "% (processor " << allToAllStats[0].first() << ')' << nl << "s (processor " << allToAllStats[0].first() << ')' << nl
<< "\t max = +" << allToAllRelMax*100 << "\t max = " << allToAllStats[1].second()
<< "% (processor " << allToAllStats[1].first() << ')' << endl; << "s (processor " << allToAllStats[1].first() << ')' << endl;
} }
} }
@ -224,7 +215,6 @@ bool Foam::functionObjects::parProfiling::write()
bool Foam::functionObjects::parProfiling::end() bool Foam::functionObjects::parProfiling::end()
{ {
report();
profilingPstream::disable(); profilingPstream::disable();
return true; return true;
} }

View File

@ -30,6 +30,20 @@ Group
Description Description
Simple (simplistic) mpi-profiling. Simple (simplistic) mpi-profiling.
Usage
Example of function object specification:
\verbatim
profiling
{
type parProfiling;
libs ("libutilityFunctionObjects.so");
// Report stats on exit only (instead of every time step)
executeControl onEnd;
writeControl none;
}
\endverbatim
SourceFiles SourceFiles
parProfiling.C parProfiling.C

View File

@ -12,8 +12,9 @@ profiling
libs ("libutilityFunctionObjects.so"); libs ("libutilityFunctionObjects.so");
executeControl none; // Report stats on exit only (instead of every time step)
writeControl writeTime; executeControl onEnd;
writeControl none;
} }