Commit 1d2d95e3 authored by Mark Abraham's avatar Mark Abraham Committed by David van der Spoel
Browse files

Don't print invalid performance data

If mdrun finished before a scheduled reset of the timing information
(e.g. from mdrun -resetstep or mdrun -resethway), then misleading
timing information should not be reported.

Fixes #2041

Change-Id: I4bd4383c924a342c01e9a3f06b521da128f96a35
parent 6b3b7474
......@@ -3,7 +3,7 @@
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
* Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
......@@ -52,6 +52,7 @@
#include "gromacs/essentialdynamics/edsam.h"
#include "gromacs/ewald/pme.h"
#include "gromacs/gmxlib/chargegroup.h"
#include "gromacs/gmxlib/md_logging.h"
#include "gromacs/gmxlib/network.h"
#include "gromacs/gmxlib/nrnb.h"
#include "gromacs/gmxlib/nonbonded/nb_free_energy.h"
......@@ -2574,6 +2575,13 @@ void finish_run(FILE *fplog, t_commrec *cr,
elapsed_time_over_all_threads,
elapsed_time_over_all_threads_over_all_ranks;
if (!walltime_accounting_get_valid_finish(walltime_accounting))
{
md_print_warn(cr, fplog,
"Simulation ended prematurely, no performance report will be written.");
return;
}
if (cr->nnodes > 1)
{
snew(nrnb_tot, 1);
......
......@@ -2,7 +2,7 @@
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2013, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
* Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
......@@ -86,6 +86,8 @@ typedef struct gmx_walltime_accounting {
int numOpenMPThreads;
//! Set by integrators to report the amount of work they did
gmx_int64_t nsteps_done;
//! Whether the simulation has finished in a way valid for walltime reporting.
bool isValidFinish;
} t_gmx_walltime_accounting;
/*! \brief Calls system timing routines (e.g. clock_gettime) to get
......@@ -116,6 +118,7 @@ walltime_accounting_init(int numOpenMPThreads)
walltime_accounting->elapsed_time = 0;
walltime_accounting->nsteps_done = 0;
walltime_accounting->numOpenMPThreads = numOpenMPThreads;
walltime_accounting->isValidFinish = false;
return walltime_accounting;
}
......@@ -229,6 +232,19 @@ gmx_gettime()
#endif
}
void
walltime_accounting_set_valid_finish(gmx_walltime_accounting_t walltime_accounting)
{
walltime_accounting->isValidFinish = true;
}
//! Return whether the simulation finished in a way valid for reporting walltime.
bool
walltime_accounting_get_valid_finish(const gmx_walltime_accounting_t walltime_accounting)
{
return walltime_accounting->isValidFinish;
}
static double
gmx_gettime_per_thread()
{
......
......@@ -3,7 +3,7 @@
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014, by the GROMACS development team, led by
* Copyright (c) 2013,2014,2017, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
......@@ -102,6 +102,14 @@ void
walltime_accounting_set_nsteps_done(gmx_walltime_accounting_t walltime_accounting,
gmx_int64_t nsteps_done);
//! Record that the simulation finished in a way valid for reporting walltime.
void
walltime_accounting_set_valid_finish(gmx_walltime_accounting_t walltime_accounting);
//! Return whether the simulation finished in a way valid for reporting walltime.
bool
walltime_accounting_get_valid_finish(const gmx_walltime_accounting_t walltime_accounting);
/*! \brief
* Calls system timing routines (e.g. clock_gettime) to get the (fractional)
* number of seconds elapsed since the epoch.
......
......@@ -3,7 +3,7 @@
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
* Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
......@@ -1839,6 +1839,12 @@ double gmx::do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
IMD_finalize(ir->bIMD, ir->imd);
walltime_accounting_set_nsteps_done(walltime_accounting, step_rel);
if (step_rel >= wcycle_get_reset_counters(wcycle) &&
signals[eglsRESETCOUNTERS].set == 0 &&
!bResetCountersHalfMaxH)
{
walltime_accounting_set_valid_finish(walltime_accounting);
}
return 0;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment