Added documentation for gmx_runtime_t struct
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 25 Sep 2013 21:22:50 +0000 (23:22 +0200)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Sat, 26 Oct 2013 05:44:58 +0000 (07:44 +0200)
Now it is clear what should be done to simplify things, noted inline
with TODO comments.

Change-Id: If66157d9fe924ca1f02b6ffbdd4526feb9ac9784

src/gromacs/legacyheaders/sim_util.h
src/gromacs/mdlib/sim_util.c
src/programs/mdrun/runner.c

index 7d53dd3a9cf1c393c27c06a5754e4f5b5ba6cfc1..8e51d1bb8c3df9ace21380d88f97199cc15a42f6 100644 (file)
@@ -64,18 +64,23 @@ typedef struct {
 
 typedef struct gmx_global_stat *gmx_global_stat_t;
 
+/*! /brief Manages measuring wall clock times for simulations */
 typedef struct {
-    double          real;
+    double          real;     //!< Seconds since the epoch recorded at the start of the simulation
+    // TODO rename real
 #ifdef GMX_CRAY_XT3
-    double          proc;
+    double          proc;     //!< Seconds since the start start of the simulation
 #else
-    clock_t         proc;
+    clock_t         proc;     //!< Seconds since the start start of the simulation
 #endif
-    double          realtime;
-    double          proctime;
-    double          time_per_step;
-    double          last;
-    gmx_large_int_t nsteps_done;
+    double          realtime; //!< Total seconds elapsed over the simulation
+    // TODO rename realtime
+    double          proctime; //!< Total seconds elapsed over the simulation
+    // TODO eliminate use of proc and proctime - also eliminates
+    // dependency on clock() and dclock()
+    double          time_per_step; //!< Local variable TODO kill this
+    double          last;          //!< Local variable TODO kill this
+    gmx_large_int_t nsteps_done;   //!< Used by integrators to report the amount of work they did
 } gmx_runtime_t;
 
 
index 0d5173ed049be6ad307e1ce05885c2b4a5608a5f..2b35fb6f9a488cd5f6571ee556a830d6af5c7ec3 100644 (file)
@@ -108,6 +108,11 @@ gmx_gettime()
     struct timeval t;
     double         seconds;
 
+    // TODO later: gettimeofday() is deprecated by POSIX. We could use
+    // clock_gettime in POSIX (which also offers nanosecond resolution
+    // if the hardware supports it), but that requires linking with
+    // -lrt. Maybe a better option will come along before we have to
+    // really change from gettimeofday().
     gettimeofday(&t, NULL);
 
     seconds = (double) t.tv_sec + 1e-6*(double)t.tv_usec;
@@ -122,7 +127,7 @@ gmx_gettime()
 #endif
 }
 
-
+// TODO Remove this. gmx_gettime returns double, so this is now useless
 #define difftime(end, start) ((double)(end)-(double)(start))
 
 void print_time(FILE *out, gmx_runtime_t *runtime, gmx_large_int_t step,
@@ -179,6 +184,7 @@ void print_time(FILE *out, gmx_runtime_t *runtime, gmx_large_int_t step,
     fflush(out);
 }
 
+// TODO eliminate this
 #ifdef NO_CLOCK
 #define clock() -1
 #endif
index 127234eb3ade4924c8d7507852351139bc2b1cae..e3f6da4d68bac302d5266348251fc675e856ec13 100644 (file)
@@ -1603,6 +1603,8 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
         gmx_pmeonly(*pmedata, cr, nrnb, wcycle, &runtime, ewaldcoeff, inputrec);
     }
 
+    // TODO remove this, nobody reads runtime.real or runtime.proc after
+    // this point - runtime_end() has already been called!
     if (EI_DYNAMICS(inputrec->eI) || EI_TPI(inputrec->eI))
     {
         /* Some timing stats */