From 751a4562d709f15cb7aeba72941554a6c6dbd04e Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Fri, 1 Jul 2022 09:41:43 -0400 Subject: [PATCH] Timing improvement --- Grid/algorithms/iterative/ConjugateGradient.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Grid/algorithms/iterative/ConjugateGradient.h b/Grid/algorithms/iterative/ConjugateGradient.h index 9a644c7e..b65eea46 100644 --- a/Grid/algorithms/iterative/ConjugateGradient.h +++ b/Grid/algorithms/iterative/ConjugateGradient.h @@ -120,6 +120,9 @@ public: SolverTimer.Start(); int k; for (k = 1; k <= MaxIterations; k++) { + + GridStopWatch IterationTimer; + IterationTimer.Start(); c = cp; MatrixTimer.Start(); @@ -152,12 +155,13 @@ public: LinearCombTimer.Stop(); LinalgTimer.Stop(); + IterationTimer.Stop(); if ( (k % 500) == 0 ) { std::cout << GridLogMessage << "ConjugateGradient: Iteration " << k << " residual " << sqrt(cp/ssq) << " target " << Tolerance << std::endl; } else { std::cout << GridLogIterative << "ConjugateGradient: Iteration " << k - << " residual " << sqrt(cp/ssq) << " target " << Tolerance << std::endl; + << " residual " << sqrt(cp/ssq) << " target " << Tolerance << " took " << IterationTimer.Elapsed() << std::endl; } // Stopping condition