diff --git a/src/solvers/pde/tnlPDESolver_impl.h b/src/solvers/pde/tnlPDESolver_impl.h index 8c1cf924762dca784d7637213106a247fdd84002..cb820815a14d99c2184ae9d56bbafa1c16dfa1a2 100644 --- a/src/solvers/pde/tnlPDESolver_impl.h +++ b/src/solvers/pde/tnlPDESolver_impl.h @@ -286,11 +286,8 @@ getTimeStepOrder() const return this->timeStepOrder; } -template< typename Problem, - typename TimeStepper > -void -tnlPDESolver< Problem, TimeStepper >:: -setIoRtTimer( tnlTimerRT& ioRtTimer ) +template< typename Problem, typename TimeStepper > +void tnlPDESolver< Problem, TimeStepper > :: setIoRtTimer( tnlTimerRT& ioRtTimer ) { this->ioRtTimer = &ioRtTimer; } @@ -332,12 +329,22 @@ solve() IndexType step( 0 ); IndexType allSteps = ceil( ( this->finalTime - this->initialTime ) / this->snapshotPeriod ); + this->ioRtTimer->start(); + this->ioCpuTimer->start(); + this->computeRtTimer->stop(); + this->computeCpuTimer->stop(); + if( ! this->problem->makeSnapshot( t, step, mesh, this->dofs, this->meshDependentData ) ) { cerr << "Making the snapshot failed." << endl; return false; } + this->ioRtTimer->stop(); + this->ioCpuTimer->stop(); + this->computeRtTimer->start(); + this->computeCpuTimer->start(); + /**** * Initialize the time stepper */ @@ -364,10 +371,10 @@ solve() return false; } - this-> ioRtTimer->stop(); - this-> ioCpuTimer->stop(); - this-> computeRtTimer->start(); - this-> computeCpuTimer->start(); + this->ioRtTimer->stop(); + this->ioCpuTimer->stop(); + this->computeRtTimer->start(); + this->computeCpuTimer->start(); } return true; } diff --git a/src/solvers/pde/tnlSemiImplicitTimeStepper.h b/src/solvers/pde/tnlSemiImplicitTimeStepper.h index ab23a123dd6639794142e0dad15bc25206a41bb8..a7f333b4d51b115390d5159ac18a2c38f5b895ac 100644 --- a/src/solvers/pde/tnlSemiImplicitTimeStepper.h +++ b/src/solvers/pde/tnlSemiImplicitTimeStepper.h @@ -79,7 +79,7 @@ class tnlSemiImplicitTimeStepper RealType timeStep; - tnlTimerRT linearSystemAssemblerTimer, linearSystemSolverTimer; + tnlTimerRT preIterateTimer, linearSystemAssemblerTimer, linearSystemSolverTimer, postIterateTimer; bool verbose; }; diff --git a/src/solvers/pde/tnlSemiImplicitTimeStepper_impl.h b/src/solvers/pde/tnlSemiImplicitTimeStepper_impl.h index 57c87ae1407ba0faed345ad8bae1aae1218f90b5..93e256979c52c333b9e5893bcf72ebfa1517b649 100644 --- a/src/solvers/pde/tnlSemiImplicitTimeStepper_impl.h +++ b/src/solvers/pde/tnlSemiImplicitTimeStepper_impl.h @@ -145,6 +145,7 @@ solve( const RealType& time, { RealType currentTau = Min( this->timeStep, stopTime - t ); + this->preIterateTimer.start(); if( ! this->problem->preIterate( t, currentTau, mesh, @@ -154,8 +155,11 @@ solve( const RealType& time, cerr << endl << "Preiteration failed." << endl; return false; } + this->preIterateTimer.stop(); + if( verbose ) cout << " Assembling the linear system ... \r" << flush; + this->linearSystemAssemblerTimer.start(); this->problem->assemblyLinearSystem( t, currentTau, @@ -165,8 +169,10 @@ solve( const RealType& time, this->rightHandSide, meshDependentData ); this->linearSystemAssemblerTimer.stop(); + if( verbose ) cout << " Solving the linear system for time " << t << " \r" << flush; + this->linearSystemSolverTimer.start(); if( ! this->linearSystemSolver->template solve< DofVectorType, tnlLinearResidueGetter< MatrixType, DofVectorType > >( this->rightHandSide, dofVector ) ) { @@ -174,8 +180,11 @@ solve( const RealType& time, return false; } this->linearSystemSolverTimer.stop(); + //if( verbose ) // cout << endl; + + this->postIterateTimer.start(); if( ! this->problem->postIterate( t, currentTau, mesh, @@ -185,6 +194,8 @@ solve( const RealType& time, cerr << endl << "Postiteration failed." << endl; return false; } + this->postIterateTimer.stop(); + t += currentTau; } return true; @@ -196,8 +207,10 @@ bool tnlSemiImplicitTimeStepper< Problem, LinearSystemSolver >:: writeEpilog( tnlLogger& logger ) { + logger.writeParameter< double >( "Pre-iterate time:", this->preIterateTimer.getTime() ); logger.writeParameter< double >( "Linear system assembler time:", this->linearSystemAssemblerTimer.getTime() ); logger.writeParameter< double >( "Linear system solver time:", this->linearSystemSolverTimer.getTime() ); + logger.writeParameter< double >( "Post-iterate time:", this->postIterateTimer.getTime() ); return true; }