From 9ea4e8de02f02d769d4ba5c76564366e8ac9a226 Mon Sep 17 00:00:00 2001
From: Thomas Witkowski <thomas.witkowski@gmx.de>
Date: Thu, 23 Dec 2010 11:31:18 +0000
Subject: [PATCH] Add some more timing information and very small bugfix for
 sequential compiling.

---
 AMDiS/libtool                         |  6 ++---
 AMDiS/src/ProblemInstat.cc            |  2 +-
 AMDiS/src/ProblemVec.cc               | 37 ++++++++++++++++++++++-----
 AMDiS/src/StandardProblemIteration.cc | 10 ++++++++
 4 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/AMDiS/libtool b/AMDiS/libtool
index 1a37a1c4..ace48e58 100755
--- a/AMDiS/libtool
+++ b/AMDiS/libtool
@@ -44,7 +44,7 @@ available_tags=" CXX F77"
 
 # ### BEGIN LIBTOOL CONFIG
 
-# Libtool was configured on host deimos102:
+# Libtool was configured on host p1q024:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
@@ -6760,7 +6760,7 @@ build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
 # End:
 # ### BEGIN LIBTOOL TAG CONFIG: CXX
 
-# Libtool was configured on host deimos102:
+# Libtool was configured on host p1q024:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
@@ -7065,7 +7065,7 @@ include_expsyms=""
 
 # ### BEGIN LIBTOOL TAG CONFIG: F77
 
-# Libtool was configured on host deimos102:
+# Libtool was configured on host p1q024:
 
 # Shell to use when invoking shell scripts.
 SHELL="/bin/sh"
diff --git a/AMDiS/src/ProblemInstat.cc b/AMDiS/src/ProblemInstat.cc
index 267a0aa2..8c67ac04 100644
--- a/AMDiS/src/ProblemInstat.cc
+++ b/AMDiS/src/ProblemInstat.cc
@@ -9,7 +9,7 @@
 //
 // See also license.opensource.txt in the distribution.
 
-#ifndef HAVE_PARALLEL_DOMAIN_AMDIS
+#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
 #include <mpi.h>
 #endif
 
diff --git a/AMDiS/src/ProblemVec.cc b/AMDiS/src/ProblemVec.cc
index 42917ac9..20735008 100644
--- a/AMDiS/src/ProblemVec.cc
+++ b/AMDiS/src/ProblemVec.cc
@@ -570,6 +570,7 @@ namespace AMDiS {
     }
 
 #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
+    MPI::COMM_WORLD.Barrier();
     INFO(info, 8)("estimation of the error needed %.5f seconds\n", 
 		  MPI::Wtime() - first);
 #else
@@ -651,20 +652,35 @@ namespace AMDiS {
     FUNCNAME("ProblemVec::buildAfterCoarsen()");
 
     if (dualMeshTraverseRequired()) {
+#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
+      ERROR_EXIT("Dual mesh assemble does not work in parallel code!\n");
+#endif
+
       dualAssemble(adaptInfo, flag, asmMatrix, asmVector);
       return;
     }
 
-    //    printOpenmpTraverseInfo(this, true);
-    //    std::cout << "ElInfo = " << ElInfo::subElemMatrices.size() << std::endl;
+#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
+    double first = MPI::Wtime();
+#endif
+
 
     for (unsigned int i = 0; i < meshes.size(); i++)
       meshes[i]->dofCompress();
 
 
-    clock_t first = clock();
+#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
+    MPI::COMM_WORLD.Barrier();
+    INFO(info, 8)("dof compression needed %.5f seconds\n", 
+		  MPI::Wtime() - first);
+
+    first = MPI::Wtime();
+#else
 #ifdef _OPENMP
-    double wtime = omp_get_wtime();
+    double first = omp_get_wtime();
+#else
+    clock_t first = clock();
+#endif
 #endif
 
 
@@ -786,13 +802,19 @@ namespace AMDiS {
       INFO(info, 8)("fillin of assembled matrix: %d\n", nnz);
     }
 
+#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
+    MPI::COMM_WORLD.Barrier();
+    INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n", 
+		  MPI::Wtime() - first);
+#else
 #ifdef _OPENMP
-    INFO(info, 8)("buildAfterCoarsen needed %.5f seconds system time / %.5f seconds wallclock time\n",
-		  TIME_USED(first, clock()), omp_get_wtime() - wtime);
+    INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n",
+		  omp_get_wtime() - wtime);
 #else
     INFO(info, 8)("buildAfterCoarsen needed %.5f seconds\n", 
 		  TIME_USED(first, clock()));    
-#endif    
+#endif
+#endif
   }
 
 
@@ -1109,6 +1131,7 @@ namespace AMDiS {
     }
 
 #ifdef HAVE_PARALLEL_DOMAIN_AMDIS
+    MPI::COMM_WORLD.Barrier();
     INFO(info, 8)("writeFiles needed %.5f seconds\n",
 		  MPI::Wtime() - first);
 #else
diff --git a/AMDiS/src/StandardProblemIteration.cc b/AMDiS/src/StandardProblemIteration.cc
index 04c2ddf5..ca259224 100644
--- a/AMDiS/src/StandardProblemIteration.cc
+++ b/AMDiS/src/StandardProblemIteration.cc
@@ -66,6 +66,10 @@ namespace AMDiS {
 
     Flag flag = 0, markFlag = 0;
 
+#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
+    double first = MPI::Wtime();
+#endif
+
     if (toDo.isSet(MARK))
       markFlag = problem->markElements(adaptInfo);
     else
@@ -85,6 +89,12 @@ namespace AMDiS {
     if (toDo.isSet(ADAPT) && markFlag.isSet(MESH_COARSENED))
       flag |= problem->coarsenMesh(adaptInfo);
 
+#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
+    MPI::COMM_WORLD.Barrier();
+    INFO(info, 8)("Local mesh adaption needed %.5f seconds\n", 
+		  MPI::Wtime() - first);
+#endif
+
     if (toDo.isSet(BUILD))
       problem->buildAfterCoarsen(adaptInfo, markFlag, true, true);
 
-- 
GitLab