Commit 2d884394 authored by Berk Hess's avatar Berk Hess Committed by Mark Abraham
Browse files

Remove warnings on checkpoint mismatch

mdrun now only warns for mismatch in minor version, build or
number of ranks used when reproducibility is requested.
Also added a separate message for not matching precision.

Fixes #1992.

Change-Id: Ia20e6beff86484f0b70148c155cdb53fed012136
parent 0ffc9f4f
......@@ -1742,41 +1742,47 @@ static void check_match(FILE *fplog,
char *btime, char *buser, char *bhost, int double_prec,
char *fprog,
const t_commrec *cr, int npp_f, int npme_f,
ivec dd_nc, ivec dd_nc_f)
ivec dd_nc, ivec dd_nc_f,
gmx_bool reproducibilityRequested)
{
int npp;
gmx_bool mm = FALSE;
gmx_bool patchlevel_differs = FALSE;
gmx_bool version_differs = FALSE;
check_string(fplog, "Version", gmx_version(), version, &mm);
patchlevel_differs = mm;
/* Note that this check_string on the version will also print a message
* when only the minor version differs. But we only print a warning
* message further down with reproducibilityRequested=TRUE.
*/
gmx_bool versionDiffers = FALSE;
check_string(fplog, "Version", gmx_version(), version, &versionDiffers);
if (patchlevel_differs)
gmx_bool precisionDiffers = FALSE;
check_int (fplog, "Double prec.", GMX_DOUBLE, double_prec, &precisionDiffers);
if (precisionDiffers)
{
/* Gromacs should be able to continue from checkpoints between
* different patch level versions, but we do not guarantee
* compatibility between different major/minor versions - check this.
*/
int gmx_major;
int cpt_major;
sscanf(gmx_version(), "%5d", &gmx_major);
int ret = sscanf(version, "%5d", &cpt_major);
version_differs = (ret < 1 || gmx_major != cpt_major);
const char msg_precision_difference[] =
"You are continuing a simulation with a different precision. Not matching\n"
"single/double precision will lead to precision or performance loss.\n";
fprintf(stderr, "%s\n", msg_precision_difference);
if (fplog)
{
fprintf(fplog, "%s\n", msg_precision_difference);
}
}
check_string(fplog, "Build time", BUILD_TIME, btime, &mm);
check_string(fplog, "Build user", BUILD_USER, buser, &mm);
check_string(fplog, "Build host", BUILD_HOST, bhost, &mm);
check_int (fplog, "Double prec.", GMX_DOUBLE, double_prec, &mm);
check_string(fplog, "Program name", gmx::getProgramContext().fullBinaryPath(), fprog, &mm);
gmx_bool mm = (versionDiffers || precisionDiffers);
check_int (fplog, "#ranks", cr->nnodes, npp_f+npme_f, &mm);
if (cr->nnodes > 1)
if (reproducibilityRequested)
{
check_string(fplog, "Build time", BUILD_TIME, btime, &mm);
check_string(fplog, "Build user", BUILD_USER, buser, &mm);
check_string(fplog, "Build host", BUILD_HOST, bhost, &mm);
check_string(fplog, "Program name", gmx::getProgramContext().fullBinaryPath(), fprog, &mm);
check_int (fplog, "#ranks", cr->nnodes, npp_f+npme_f, &mm);
}
if (cr->nnodes > 1 && reproducibilityRequested)
{
check_int (fplog, "#PME-ranks", cr->npmenodes, npme_f, &mm);
npp = cr->nnodes;
int npp = cr->nnodes;
if (cr->npmenodes >= 0)
{
npp -= cr->npmenodes;
......@@ -1791,7 +1797,17 @@ static void check_match(FILE *fplog,
if (mm)
{
const char msg_version_difference[] =
/* Gromacs should be able to continue from checkpoints between
* different patch level versions, but we do not guarantee
* compatibility between different major/minor versions - check this.
*/
int gmx_major;
int cpt_major;
sscanf(gmx_version(), "%5d", &gmx_major);
int ret = sscanf(version, "%5d", &cpt_major);
gmx_bool majorVersionDiffers = (ret < 1 || gmx_major != cpt_major);
const char msg_major_version_difference[] =
"The current GROMACS major version is not identical to the one that\n"
"generated the checkpoint file. In principle GROMACS does not support\n"
"continuation from checkpoints between different versions, so we advise\n"
......@@ -1807,16 +1823,16 @@ static void check_match(FILE *fplog,
const char msg_logdetails[] =
"See the log file for details.\n";
if (version_differs)
if (majorVersionDiffers)
{
fprintf(stderr, "%s%s\n", msg_version_difference, fplog ? msg_logdetails : "");
fprintf(stderr, "%s%s\n", msg_major_version_difference, fplog ? msg_logdetails : "");
if (fplog)
{
fprintf(fplog, "%s\n", msg_version_difference);
fprintf(fplog, "%s\n", msg_major_version_difference);
}
}
else
else if (reproducibilityRequested)
{
/* Major & minor versions match at least, but something is different. */
fprintf(stderr, "%s%s\n", msg_mismatch_notice, fplog ? msg_logdetails : "");
......@@ -1834,7 +1850,8 @@ static void read_checkpoint(const char *fn, FILE **pfplog,
int eIntegrator, int *init_fep_state, gmx_int64_t *step, double *t,
t_state *state, gmx_bool *bReadEkin,
int *simulation_part,
gmx_bool bAppendOutputFiles, gmx_bool bForceAppend)
gmx_bool bAppendOutputFiles, gmx_bool bForceAppend,
gmx_bool reproducibilityRequested)
{
t_fileio *fp;
int i, j, rc;
......@@ -2005,7 +2022,8 @@ static void read_checkpoint(const char *fn, FILE **pfplog,
if (MASTER(cr))
{
check_match(fplog, version, btime, buser, bhost, double_prec, fprog,
cr, nppnodes_f, npmenodes_f, dd_nc, dd_nc_f);
cr, nppnodes_f, npmenodes_f, dd_nc, dd_nc_f,
reproducibilityRequested);
}
}
ret = do_cpt_state(gmx_fio_getxdr(fp), TRUE, fflags, state, NULL);
......@@ -2231,7 +2249,8 @@ void load_checkpoint(const char *fn, FILE **fplog,
const t_commrec *cr, ivec dd_nc, int *npme,
t_inputrec *ir, t_state *state,
gmx_bool *bReadEkin,
gmx_bool bAppend, gmx_bool bForceAppend)
gmx_bool bAppend, gmx_bool bForceAppend,
gmx_bool reproducibilityRequested)
{
gmx_int64_t step;
double t;
......@@ -2242,7 +2261,8 @@ void load_checkpoint(const char *fn, FILE **fplog,
read_checkpoint(fn, fplog,
cr, dd_nc, npme,
ir->eI, &(ir->fepvals->init_fep_state), &step, &t, state, bReadEkin,
&ir->simulation_part, bAppend, bForceAppend);
&ir->simulation_part, bAppend, bForceAppend,
reproducibilityRequested);
}
if (PAR(cr))
{
......
......@@ -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, by the GROMACS development team, led by
* Copyright (c) 2013,2014,2015,2016, 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.
......@@ -78,12 +78,14 @@ void write_checkpoint(const char *fn, gmx_bool bNumberAndKeep,
* files so they can be appended.
* With bAppend and bForceAppend: truncate anyhow if the system does not
* support file locking.
* With reproducibilityRequested warns about version, build, #ranks differences.
*/
void load_checkpoint(const char *fn, FILE **fplog,
const t_commrec *cr, ivec dd_nc, int *npme,
t_inputrec *ir, t_state *state,
gmx_bool *bReadEkin,
gmx_bool bAppend, gmx_bool bForceAppend);
gmx_bool bAppend, gmx_bool bForceAppend,
gmx_bool reproducibilityRequested);
/* Read the state from checkpoint file.
* Arrays in state that are NULL are allocated.
......
......@@ -983,7 +983,8 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
cr, ddxyz, &npme,
inputrec, state, &bReadEkin,
(Flags & MD_APPENDFILES),
(Flags & MD_APPENDFILESSET));
(Flags & MD_APPENDFILESSET),
(Flags & MD_REPRODUCIBLE));
if (bReadEkin)
{
......
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