From dc1b92521a465b65c4901b94e94979a1b38de7ae Mon Sep 17 00:00:00 2001 From: Andreas Lauser Date: Tue, 5 Feb 2019 16:51:34 +0100 Subject: [PATCH] ebos: make it possible to account for external setup costs --- ebos/eclbasevanguard.hh | 18 ++++++++++++++++++ ebos/eclwriter.hh | 9 ++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ebos/eclbasevanguard.hh b/ebos/eclbasevanguard.hh index 301fafd2e..3144cd9d7 100644 --- a/ebos/eclbasevanguard.hh +++ b/ebos/eclbasevanguard.hh @@ -148,6 +148,20 @@ public: throw std::invalid_argument("Cannot find input case '"+caseName+"'"); } + /*! + * \brief Set the wall time which was spend externally to set up the external data structures + * + * i.e., the objects specified via the other setExternal*() methods. + */ + static void setExternalSetupTime(Scalar t) + { externalSetupTime_ = t; } + + /*! + * \brief Returns the wall time required to set up the simulator before it was born. + */ + static Scalar externalSetupTime() + { return externalSetupTime_; } + /*! * \brief Set the Opm::EclipseState and the Opm::Deck object which ought to be used * when the simulator vanguard is instantiated. @@ -469,6 +483,7 @@ private: std::string caseName_; + static Scalar externalSetupTime_; static Opm::Deck* externalDeck_; static Opm::EclipseState* externalEclState_; static Opm::Schedule* externalEclSchedule_; @@ -487,6 +502,9 @@ private: Opm::SummaryConfig* eclSummaryConfig_; }; +template +typename EclBaseVanguard::Scalar EclBaseVanguard::externalSetupTime_ = 0.0; + template Opm::Deck* EclBaseVanguard::externalDeck_ = nullptr; diff --git a/ebos/eclwriter.hh b/ebos/eclwriter.hh index 6b8822b7e..d9198c382 100644 --- a/ebos/eclwriter.hh +++ b/ebos/eclwriter.hh @@ -150,7 +150,10 @@ public: void writeOutput(bool isSubStep) { Scalar curTime = simulator_.time() + simulator_.timeStepSize(); - Scalar totalSolverTime = simulator_.executionTimer().realTimeElapsed(); + Scalar totalCpuTime = + simulator_.executionTimer().realTimeElapsed() + + simulator_.setupTimer().realTimeElapsed() + + simulator_.vanguard().externalSetupTime(); Scalar nextStepSize = simulator_.problem().nextTimeStepSize(); // output using eclWriter if enabled @@ -195,8 +198,8 @@ public: const auto& simConfig = eclState.getSimulationConfig(); // Add TCPU - if (totalSolverTime != 0.0) - miscSummaryData["TCPU"] = totalSolverTime; + if (totalCpuTime != 0.0) + miscSummaryData["TCPU"] = totalCpuTime; bool enableDoublePrecisionOutput = EWOMS_GET_PARAM(TypeTag, bool, EclOutputDoublePrecision); const Opm::data::Solution& cellData = collectToIORank_.isParallel() ? collectToIORank_.globalCellData() : localCellData;