Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ifpack2: fix timers #8478

Merged
merged 1 commit into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions packages/ifpack2/src/Ifpack2_AdditiveSchwarz_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_t
if (timer.is_null ()) {
timer = TimeMonitor::getNewCounter (timerName);
}
double startTime = timer->wallTime();

{ // Start timing here.
TimeMonitor timeMon (*timer);
Expand Down Expand Up @@ -617,9 +618,7 @@ apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_t

++NumApply_;

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
ApplyTime_ = timer->totalElapsedTime ();
ApplyTime_ += (timer->wallTime() - startTime);
}

template<class MatrixType,class LocalInverseType>
Expand Down Expand Up @@ -935,6 +934,7 @@ void AdditiveSchwarz<MatrixType,LocalInverseType>::initialize ()
if (timer.is_null ()) {
timer = TimeMonitor::getNewCounter (timerName);
}
double startTime = timer->wallTime();

{ // Start timing here.
TimeMonitor timeMon (*timer);
Expand Down Expand Up @@ -992,9 +992,7 @@ void AdditiveSchwarz<MatrixType,LocalInverseType>::initialize ()
IsInitialized_ = true;
++NumInitialize_;

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
InitializeTime_ = timer->totalElapsedTime ();
InitializeTime_ += (timer->wallTime() - startTime);
}


Expand Down Expand Up @@ -1036,6 +1034,7 @@ void AdditiveSchwarz<MatrixType,LocalInverseType>::compute ()
if (timer.is_null ()) {
timer = TimeMonitor::getNewCounter (timerName);
}
double startTime = timer->wallTime();

{ // Start timing here.
TimeMonitor timeMon (*timer);
Expand All @@ -1047,9 +1046,7 @@ void AdditiveSchwarz<MatrixType,LocalInverseType>::compute ()
IsComputed_ = true;
++NumCompute_;

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
ComputeTime_ = timer->totalElapsedTime ();
ComputeTime_ += (timer->wallTime() - startTime);
}

//==============================================================================
Expand Down
11 changes: 8 additions & 3 deletions packages/ifpack2/src/Ifpack2_BlockRelaxation_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ apply (const Tpetra::MultiVector<typename MatrixType::scalar_type,
timer = Teuchos::TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

{
Teuchos::TimeMonitor timeMon (*timer);

Expand Down Expand Up @@ -534,7 +536,7 @@ apply (const Tpetra::MultiVector<typename MatrixType::scalar_type,
}
}

ApplyTime_ += timer->totalElapsedTime();
ApplyTime_ += (timer->wallTime() - startTime);
++NumApply_;
}

Expand Down Expand Up @@ -570,6 +572,7 @@ initialize ()

Teuchos::RCP<Teuchos::Time> timer =
Teuchos::TimeMonitor::getNewCounter ("Ifpack2::BlockRelaxation::initialize");
double startTime = timer->wallTime();

{ // Timing of initialize starts here
Teuchos::TimeMonitor timeMon (*timer);
Expand Down Expand Up @@ -661,7 +664,7 @@ initialize ()
}
} // timing of initialize stops here

InitializeTime_ += timer->totalElapsedTime ();
InitializeTime_ += (timer->wallTime() - startTime);
++NumInitialize_;
IsInitialized_ = true;
}
Expand All @@ -686,6 +689,8 @@ compute ()
Teuchos::RCP<Teuchos::Time> timer =
Teuchos::TimeMonitor::getNewCounter ("Ifpack2::BlockRelaxation::compute");

double startTime = timer->wallTime();

{
Teuchos::TimeMonitor timeMon (*timer);

Expand All @@ -695,7 +700,7 @@ compute ()
Container_->compute(); // compute each block matrix
}

ComputeTime_ += timer->totalElapsedTime();
ComputeTime_ += (timer->wallTime() - startTime);
++NumCompute_;
IsComputed_ = true;
}
Expand Down
13 changes: 6 additions & 7 deletions packages/ifpack2/src/Ifpack2_Chebyshev_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ apply (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal
timer = Teuchos::TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

// Start timing here.
{
Teuchos::TimeMonitor timeMon (*timer);
Expand All @@ -258,10 +260,7 @@ apply (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal
applyImpl (X, Y, mode, alpha, beta);
}
++NumApply_;

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
ApplyTime_ = timer->totalElapsedTime ();
ApplyTime_ += (timer->wallTime() - startTime);
}


Expand Down Expand Up @@ -310,6 +309,8 @@ void Chebyshev<MatrixType>::compute ()
timer = Teuchos::TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

// Start timing here.
{
Teuchos::TimeMonitor timeMon (*timer);
Expand All @@ -322,9 +323,7 @@ void Chebyshev<MatrixType>::compute ()
IsComputed_ = true;
++NumCompute_;

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
ComputeTime_ = timer->totalElapsedTime ();
ComputeTime_ += (timer->wallTime() - startTime);
}


Expand Down
18 changes: 9 additions & 9 deletions packages/ifpack2/src/Ifpack2_Details_Amesos2Wrapper_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ void Amesos2Wrapper<MatrixType>::initialize ()
timer = TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

{ // Start timing here.
TimeMonitor timeMon (*timer);

Expand Down Expand Up @@ -372,9 +374,7 @@ void Amesos2Wrapper<MatrixType>::initialize ()
IsInitialized_ = true;
++NumInitialize_;

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
InitializeTime_ = timer->totalElapsedTime ();
InitializeTime_ += (timer->wallTime() - startTime);
}

template<class MatrixType>
Expand All @@ -395,6 +395,8 @@ void Amesos2Wrapper<MatrixType>::compute ()
timer = TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

{ // Start timing here.
TimeMonitor timeMon (*timer);
solver_->numeric ();
Expand All @@ -403,9 +405,7 @@ void Amesos2Wrapper<MatrixType>::compute ()
IsComputed_ = true;
++NumCompute_;

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
ComputeTime_ = timer->totalElapsedTime ();
ComputeTime_ += (timer->wallTime() - startTime);
}


Expand Down Expand Up @@ -433,6 +433,8 @@ apply (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal
timer = TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

{ // Start timing here.
TimeMonitor timeMon (*timer);

Expand Down Expand Up @@ -506,9 +508,7 @@ apply (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal

++NumApply_;

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
ApplyTime_ = timer->totalElapsedTime ();
ApplyTime_ += (timer->wallTime() - startTime);
}


Expand Down
18 changes: 9 additions & 9 deletions packages/ifpack2/src/Ifpack2_Details_DenseSolver_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ void DenseSolver<MatrixType, false>::initialize ()
timer = TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

{ // Begin timing here.
Teuchos::TimeMonitor timeMon (*timer);

Expand Down Expand Up @@ -268,9 +270,7 @@ void DenseSolver<MatrixType, false>::initialize ()
++numInitialize_;
}

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
initializeTime_ = timer->totalElapsedTime ();
initializeTime_ += (timer->wallTime() - startTime);
}


Expand All @@ -290,6 +290,8 @@ void DenseSolver<MatrixType, false>::compute ()
timer = Teuchos::TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

// Begin timing here.
{
Teuchos::TimeMonitor timeMon (*timer);
Expand All @@ -313,9 +315,7 @@ void DenseSolver<MatrixType, false>::compute ()
isComputed_ = true;
++numCompute_;
}
// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
computeTime_ = timer->totalElapsedTime ();
computeTime_ += (timer->wallTime() - startTime);
}

template<class MatrixType>
Expand Down Expand Up @@ -436,6 +436,8 @@ apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_t
timer = Teuchos::TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

// Begin timing here.
{
Teuchos::TimeMonitor timeMon (*timer);
Expand Down Expand Up @@ -482,9 +484,7 @@ apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_t
++numApply_; // We've successfully finished the work of apply().
}

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
applyTime_ = timer->totalElapsedTime ();
applyTime_ += (timer->wallTime() - startTime);
}


Expand Down
18 changes: 9 additions & 9 deletions packages/ifpack2/src/Ifpack2_Details_TriDiSolver_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ void TriDiSolver<MatrixType, false>::initialize ()
timer = TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

{ // Begin timing here.
Teuchos::TimeMonitor timeMon (*timer);

Expand Down Expand Up @@ -270,9 +272,7 @@ void TriDiSolver<MatrixType, false>::initialize ()
++numInitialize_;
}

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
initializeTime_ = timer->totalElapsedTime ();
initializeTime_ += (timer->wallTime() - startTime);
}


Expand All @@ -292,6 +292,8 @@ void TriDiSolver<MatrixType, false>::compute ()
timer = Teuchos::TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

// Begin timing here.
{
Teuchos::TimeMonitor timeMon (*timer);
Expand All @@ -316,9 +318,7 @@ void TriDiSolver<MatrixType, false>::compute ()
isComputed_ = true;
++numCompute_;
}
// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
computeTime_ = timer->totalElapsedTime ();
computeTime_ += (timer->wallTime() - startTime);
}

template<class MatrixType>
Expand Down Expand Up @@ -445,6 +445,8 @@ apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_t
timer = Teuchos::TimeMonitor::getNewCounter (timerName);
}

double startTime = timer->wallTime();

// Begin timing here.
{
Teuchos::TimeMonitor timeMon (*timer);
Expand Down Expand Up @@ -491,9 +493,7 @@ apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_t
++numApply_; // We've successfully finished the work of apply().
}

// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
applyTime_ = timer->totalElapsedTime ();
applyTime_ += (timer->wallTime() - startTime);
}


Expand Down
9 changes: 6 additions & 3 deletions packages/ifpack2/src/Ifpack2_Experimental_RBILUK_def.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ void RBILUK<MatrixType>::initialize ()
blockSize_ = A_block_->getBlockSize();

Teuchos::Time timer ("RBILUK::initialize");
double startTime = timer.wallTime();
{ // Start timing
Teuchos::TimeMonitor timeMon (timer);

Expand Down Expand Up @@ -266,7 +267,7 @@ void RBILUK<MatrixType>::initialize ()

this->isInitialized_ = true;
this->numInitialize_ += 1;
this->initializeTime_ += timer.totalElapsedTime ();
this->initializeTime_ += (timer.wallTime() - startTime);
}


Expand Down Expand Up @@ -485,6 +486,7 @@ void RBILUK<MatrixType>::compute ()
D_block_->modify_host ();

Teuchos::Time timer ("RBILUK::compute");
double startTime = timer.wallTime();
{ // Start timing
Teuchos::TimeMonitor timeMon (timer);
this->isComputed_ = false;
Expand Down Expand Up @@ -772,7 +774,7 @@ void RBILUK<MatrixType>::compute ()

this->isComputed_ = true;
this->numCompute_ += 1;
this->computeTime_ += timer.totalElapsedTime ();
this->computeTime_ += (timer.wallTime() - startTime);
}


Expand Down Expand Up @@ -823,6 +825,7 @@ apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_t
const scalar_type zero = STM::zero ();

Teuchos::Time timer ("RBILUK::apply");
double startTime = timer.wallTime();
{ // Start timing
Teuchos::TimeMonitor timeMon (timer);
if (alpha == one && beta == zero) {
Expand Down Expand Up @@ -925,7 +928,7 @@ apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_t
} // Stop timing

this->numApply_ += 1;
this->applyTime_ = timer.totalElapsedTime ();
this->applyTime_ += (timer.wallTime() - startTime);
}


Expand Down
Loading