From b72aad12b8120b3f7f03e440485eb2aa31237249 Mon Sep 17 00:00:00 2001
From: Oliver Sander <sander@igpm.rwth-aachen.de>
Date: Wed, 3 Jul 2013 16:01:11 +0000
Subject: [PATCH] Also measure assembly times using the OpenMP timers.

The Dune timers do not return wall time when using thread parallelism.

[[Imported from SVN: r9283]]
---
 dune/gfe/riemanniantrsolver.cc | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dune/gfe/riemanniantrsolver.cc b/dune/gfe/riemanniantrsolver.cc
index 1fe8b082..45d1b41a 100644
--- a/dune/gfe/riemanniantrsolver.cc
+++ b/dune/gfe/riemanniantrsolver.cc
@@ -1,3 +1,5 @@
+#include "omp.h"
+
 #include <dune/common/bitsetvector.hh>
 #include <dune/common/timer.hh>
 
@@ -237,16 +239,22 @@ void RiemannianTrustRegionSolver<GridType,TargetSpace>::solve()
         Dune::Timer gradientTimer;
         
         if (recomputeGradientHessian) {
+            
+            double oldClock = omp_get_wtime();
+
             assembler_->assembleGradient(x_, rhs);
             rhs *= -1;        // The right hand side is the _negative_ gradient
             std::cout << "gradient assembly took " << gradientTimer.elapsed() << " sec." << std::endl;
+            std::cout << "gradient assembly took " << (omp_get_wtime() - oldClock) << " sec." << std::endl;
             gradientTimer.reset();
+            oldClock = omp_get_wtime();
         
             assembler_->assembleMatrix(x_, 
                                        *hessianMatrix_, 
                                        i==0    // assemble occupation pattern only for the first call
                                        );
             std::cout << "hessian assembly took " << gradientTimer.elapsed() << " sec." << std::endl;
+            std::cout << "hessian assembly took " << (omp_get_wtime() - oldClock) << " sec." << std::endl;
             recomputeGradientHessian = false;
         }
         
-- 
GitLab