Fix total time measurement with separate PME nodes
authorMark Abraham <mark.j.abraham@gmail.com>
Sun, 25 Aug 2013 16:06:16 +0000 (18:06 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Fri, 20 Sep 2013 09:56:29 +0000 (11:56 +0200)
The runtime counter needs to be passed to the PME code so that
PME-only nodes can have their time included in the statistics.

Fixes #1325

Change-Id: I13effaa185b1290e41bdd642c607ff75ab8db929

include/pme.h
src/kernel/runner.c
src/mdlib/pme.c

index 352118bfdf4ea14c5bfbf2c395b445c32bb6ab5b..c691661a2a42e6999746104cebe2427ee3afba51 100644 (file)
@@ -44,6 +44,7 @@
 #include "typedefs.h"
 #include "gmxcomplex.h"
 #include "gmx_wallcycle.h"
+#include "sim_util.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -104,6 +105,7 @@ GMX_LIBMD_EXPORT
 int gmx_pmeonly(gmx_pme_t pme,
                 t_commrec *cr,     t_nrnb *mynrnb,
                 gmx_wallcycle_t wcycle,
+                gmx_runtime_t *runtime,
                 real ewaldcoeff,   gmx_bool bGatherOnly,
                 t_inputrec *ir);
 /* Called on the nodes that do PME exclusively (as slaves)
index 3ca6a4b57931ea6e2f31a492848a588ce181d9f2..a3ec7bf62d4f3ec5e7d65e0f1f4e9b5a319fc7b5 100644 (file)
@@ -1596,7 +1596,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
     else
     {
         /* do PME only */
-        gmx_pmeonly(*pmedata, cr, nrnb, wcycle, ewaldcoeff, FALSE, inputrec);
+        gmx_pmeonly(*pmedata, cr, nrnb, wcycle, &runtime, ewaldcoeff, FALSE, inputrec);
     }
 
     if (EI_DYNAMICS(inputrec->eI) || EI_TPI(inputrec->eI))
index df8b463d5d9e124507ecd0ef075f13d7f3afc3fd..c641e468219c39425b2fe8112ac6e8b70f58f742 100644 (file)
@@ -92,7 +92,6 @@
 #include "gmx_cyclecounter.h"
 #include "gmx_omp.h"
 
-
 /* Include the SIMD macro file and then check for support */
 #include "gmx_simd_macros.h"
 #if defined GMX_HAVE_SIMD_MACROS && defined GMX_SIMD_HAVE_EXP
@@ -4166,6 +4165,7 @@ void gmx_pme_calc_energy(gmx_pme_t pme, int n, rvec *x, real *q, real *V)
 
 
 static void reset_pmeonly_counters(t_commrec *cr, gmx_wallcycle_t wcycle,
+                                   gmx_runtime_t *runtime,
                                    t_nrnb *nrnb, t_inputrec *ir,
                                    gmx_large_int_t step)
 {
@@ -4180,6 +4180,7 @@ static void reset_pmeonly_counters(t_commrec *cr, gmx_wallcycle_t wcycle,
     }
     ir->init_step = step;
     wallcycle_start(wcycle, ewcRUN);
+    runtime_start(runtime);
 }
 
 
@@ -4220,6 +4221,7 @@ static void gmx_pmeonly_switch(int *npmedata, gmx_pme_t **pmedata,
 int gmx_pmeonly(gmx_pme_t pme,
                 t_commrec *cr,    t_nrnb *nrnb,
                 gmx_wallcycle_t wcycle,
+                gmx_runtime_t *runtime,
                 real ewaldcoeff,  gmx_bool bGatherOnly,
                 t_inputrec *ir)
 {
@@ -4275,7 +4277,7 @@ int gmx_pmeonly(gmx_pme_t pme,
             if (ret == pmerecvqxRESETCOUNTERS)
             {
                 /* Reset the cycle and flop counters */
-                reset_pmeonly_counters(cr, wcycle, nrnb, ir, step);
+                reset_pmeonly_counters(cr, wcycle, runtime, nrnb, ir, step);
             }
         }
         while (ret == pmerecvqxSWITCHGRID || ret == pmerecvqxRESETCOUNTERS);
@@ -4291,6 +4293,7 @@ int gmx_pmeonly(gmx_pme_t pme,
         if (count == 0)
         {
             wallcycle_start(wcycle, ewcRUN);
+            runtime_start(runtime);
         }
 
         wallcycle_start(wcycle, ewcPMEMESH);
@@ -4312,6 +4315,8 @@ int gmx_pmeonly(gmx_pme_t pme,
     } /***** end of quasi-loop, we stop with the break above */
     while (TRUE);
 
+    runtime_end(runtime);
+
     return 0;
 }