Unify logic for timing counts
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 28 May 2013 08:35:24 +0000 (10:35 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Tue, 28 Jan 2014 13:00:16 +0000 (14:00 +0100)
Made all integrators use the same logic for starting timing
mechanisms.

Change-Id: Id8cb154f7b96d977efffcc9533d4a6dd9894afbd

include/sim_util.h
src/kernel/md.c
src/mdlib/minimize.c
src/mdlib/sim_util.c
src/mdlib/tpi.c

index c715012eea52a5a7fca1f6d148cfdca5dbb2578f..9df55d200040378a0d67e1b066f1148f82034f70 100644 (file)
@@ -175,6 +175,10 @@ GMX_LIBMD_EXPORT
 void print_date_and_time(FILE *log, int pid, const char *title,
                          const gmx_runtime_t *runtime);
 
+GMX_LIBMD_EXPORT
+void print_start(FILE *fplog, t_commrec *cr, gmx_runtime_t *runtime,
+                 const char *name);
+
 GMX_LIBMD_EXPORT
 void finish_run(FILE *log, t_commrec *cr, const char *confout,
                 t_inputrec *inputrec,
index 61f620a67be368efa7954e62a7fc237915b35d03..803b4e643c9dacd3c30a8cbec1e52bb2e874b1f6 100644 (file)
@@ -713,14 +713,9 @@ double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
         fprintf(fplog, "\n");
     }
 
-    /* Set and write start time */
+    print_start(fplog, cr, runtime, "mdrun");
     runtime_start(runtime);
-    print_date_and_time(fplog, cr->nodeid, "Started mdrun", runtime);
     wallcycle_start(wcycle, ewcRUN);
-    if (fplog)
-    {
-        fprintf(fplog, "\n");
-    }
 
     /* safest point to do file checkpointing is here.  More general point would be immediately before integrator call */
 #ifdef GMX_FAHCORE
index 5df3936cfbef96b8583e01a95ddd9e0b27c8efb0..8afe436f44640703d2c7c6a93bc90861ae5cd038 100644 (file)
@@ -67,6 +67,7 @@
 #include "force.h"
 #include "mdrun.h"
 #include "md_support.h"
+#include "sim_util.h"
 #include "domdec.h"
 #include "partdec.h"
 #include "trnio.h"
@@ -108,15 +109,11 @@ static void print_em_start(FILE *fplog, t_commrec *cr, gmx_runtime_t *runtime,
                            gmx_wallcycle_t wcycle,
                            const char *name)
 {
-    char buf[STRLEN];
-
     runtime_start(runtime);
-
-    sprintf(buf, "Started %s", name);
-    print_date_and_time(fplog, cr->nodeid, buf, NULL);
-
     wallcycle_start(wcycle, ewcRUN);
+    print_start(fplog, cr, runtime, name);
 }
+
 static void em_time_end(FILE *fplog, t_commrec *cr, gmx_runtime_t *runtime,
                         gmx_wallcycle_t wcycle)
 {
index a6cafa8304657dd1582200325dd9e67f7d2cc986..26c709d6feec7f066328d544fd8577582da303e7 100644 (file)
@@ -288,6 +288,15 @@ void print_date_and_time(FILE *fplog, int nodeid, const char *title,
     }
 }
 
+void print_start(FILE *fplog, t_commrec *cr, gmx_runtime_t *runtime,
+                 const char *name)
+{
+    char buf[STRLEN];
+
+    sprintf(buf, "Started %s", name);
+    print_date_and_time(fplog, cr->nodeid, buf, runtime);
+}
+
 static void sum_forces(int start, int end, rvec f[], rvec flr[])
 {
     int i;
index a675316b59d6c0a35869fd13db5b49fb514f2512..227a62baac4b1efd62ec31d2a035662e6e614e11 100644 (file)
@@ -258,9 +258,8 @@ double do_tpi(FILE *fplog, t_commrec *cr,
 
     /* Print to log file  */
     runtime_start(runtime);
-    print_date_and_time(fplog, cr->nodeid,
-                        "Started Test Particle Insertion", runtime);
     wallcycle_start(wcycle, ewcRUN);
+    print_start(fplog, cr, runtime, "Test Particle Insertion");
 
     /* The last charge group is the group to be inserted */
     cg_tp = top->cgs.nr - 1;