     (pcg_data -> converged) = 0;
  
     (*(pcg_functions->CommInfo))(A,&my_id,&num_procs);
-@@ -476,6 +487,15 @@ hypre_PCGSolve( void *pcg_vdata,
+@@ -476,8 +487,18 @@ hypre_PCGSolve( void *pcg_vdata,
        }
     }
  
 +#ifdef GEOPM
 +   geopm_prof_exit(region_id);
-+#endif
-+
-+#ifdef GEOPM
-+   geopm_prof_region("PCGSolveLoop", 0, &region_id);
-+   geopm_prof_enter(region_id);
 +#endif
 +
     while ((i+1) <= max_iter)
     {
++#ifdef GEOPM
++       geopm_prof_epoch();
++       geopm_prof_region("PCGSolveLoop", 0, &region_id);
++       geopm_prof_enter(region_id);
++#endif
++
        /*--------------------------------------------------------------------
+        * the core CG calculations...
+        *--------------------------------------------------------------------*/
+@@ -711,6 +732,9 @@ hypre_PCGSolve( void *pcg_vdata,
+       else
+          (*(pcg_functions->CopyVector))(s, p);
+    }
++#ifdef GEOPM
++    geopm_prof_exit(region_id);
++#endif
+ 
+    /*--------------------------------------------------------------------
+     * Finish up with some outputs.
 diff --git a/test/amg.c b/test/amg.c
 index fb5ccb5..9c606f9 100644
 --- a/test/amg.c

-
+INCLUDE_LFLAGS += -L$(HOME)/build/geopm/lib -lgeopm -dynamic
diff --git a/krylov/pcg.c b/krylov/pcg.c
index 2492dae..a591be7 100644
--- a/krylov/pcg.c
+++ b/krylov/pcg.c
@@ -33,6 +33,10 @@

From c85f3d5f9368a2ae1e47a5dc0ada286d5a14e17c Mon Sep 17 00:00:00 2001
From: Diana Guttman <diana.r.guttman@intel.com>
Date: Tue, 18 Sep 2018 21:23:35 +0000
Subject: [PATCH] Adding geopm markup to CORAL 2 AMG.
