From c46fe63b9708b1a9ea31f49f2357678bd9f675bc Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Wed, 15 May 2019 08:30:06 +0100 Subject: [PATCH] ENH: parProfiling: do not print on exit. Fixes #1298. --- .../utilities/parProfiling/parProfiling.C | 26 ++++++------------- .../utilities/parProfiling/parProfiling.H | 14 ++++++++++ .../windAroundBuildings/system/profiling | 5 ++-- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/functionObjects/utilities/parProfiling/parProfiling.C b/src/functionObjects/utilities/parProfiling/parProfiling.C index ade16fb0516..5ba3797594d 100644 --- a/src/functionObjects/utilities/parProfiling/parProfiling.C +++ b/src/functionObjects/utilities/parProfiling/parProfiling.C @@ -183,28 +183,19 @@ void Foam::functionObjects::parProfiling::report() const statData& allToAllStats = times[1]; 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 allToAllRelMin = - (allToAllStats[0].second()-allToAllAvg)/(allToAllAvg + VSMALL); - scalar allToAllRelMax = - (allToAllStats[1].second()-allToAllAvg)/(allToAllAvg + VSMALL); Info<< type() << ':' << nl << "\treduce : avg = " << reduceAvg << 's' << nl - << "\t min = " << reduceRelMin*100 - << "% (processor " << reduceStats[0].first() << ')' << nl - << "\t max = +" << reduceRelMax*100 - << "% (processor " << reduceStats[1].first() << ')' << nl + << "\t min = " << reduceStats[0].second() + << "s (processor " << reduceStats[0].first() << ')' << nl + << "\t max = " << reduceStats[1].second() + << "s (processor " << reduceStats[1].first() << ')' << nl << "\tall-all : avg = " << allToAllAvg << 's' << nl - << "\t min = " << allToAllRelMin*100 - << "% (processor " << allToAllStats[0].first() << ')' << nl - << "\t max = +" << allToAllRelMax*100 - << "% (processor " << allToAllStats[1].first() << ')' << endl; + << "\t min = " << allToAllStats[0].second() + << "s (processor " << allToAllStats[0].first() << ')' << nl + << "\t max = " << allToAllStats[1].second() + << "s (processor " << allToAllStats[1].first() << ')' << endl; } } @@ -224,7 +215,6 @@ bool Foam::functionObjects::parProfiling::write() bool Foam::functionObjects::parProfiling::end() { - report(); profilingPstream::disable(); return true; } diff --git a/src/functionObjects/utilities/parProfiling/parProfiling.H b/src/functionObjects/utilities/parProfiling/parProfiling.H index 32b055bc547..1b7dbf28dbf 100644 --- a/src/functionObjects/utilities/parProfiling/parProfiling.H +++ b/src/functionObjects/utilities/parProfiling/parProfiling.H @@ -30,6 +30,20 @@ Group Description 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 parProfiling.C diff --git a/tutorials/incompressible/simpleFoam/windAroundBuildings/system/profiling b/tutorials/incompressible/simpleFoam/windAroundBuildings/system/profiling index b0865c6bb66..f66e2e99ed5 100644 --- a/tutorials/incompressible/simpleFoam/windAroundBuildings/system/profiling +++ b/tutorials/incompressible/simpleFoam/windAroundBuildings/system/profiling @@ -12,8 +12,9 @@ profiling libs ("libutilityFunctionObjects.so"); - executeControl none; - writeControl writeTime; + // Report stats on exit only (instead of every time step) + executeControl onEnd; + writeControl none; } -- GitLab