real rdd, real rconstr, const char *dddlb_opt, real dlb_scale,
const char *ddcsx, const char *ddcsy, const char *ddcsz,
const char *nbpu_opt,
- int nsteps_cmdline, int nstepout, int resetstep,
+ gmx_large_int_t nsteps_cmdline, int nstepout, int resetstep,
int nmultisim, int repl_ex_nst, int repl_ex_nex,
int repl_ex_seed, real pforce, real cpt_period, real max_hours,
const char *deviceOptions, unsigned long Flags);
SEL_CDATA_MINMAXALLOC = 16,
/** Whether subexpressions use simple pass evaluation functions. */
SEL_CDATA_SIMPLESUBEXPR = 32,
- /** Whether this expressions is a part of a common subexpression. */
- SEL_CDATA_COMMONSUBEXPR = 64
+ /*! \brief
+ * Whether a static subexpression needs to support multiple evaluations.
+ *
+ * This flag may only be set on \ref SEL_SUBEXPR elements that also have
+ * SEL_CDATA_SIMPLESUBEXPR.
+ */
+ SEL_CDATA_STATICMULTIEVALSUBEXPR = 64,
+ /** Whether this expression is a part of a common subexpression. */
+ SEL_CDATA_COMMONSUBEXPR = 128
};
/*! \internal \brief
{
fprintf(fp, "Ss");
}
+ if (sel->cdata->flags & SEL_CDATA_STATICMULTIEVALSUBEXPR)
+ {
+ fprintf(fp, "Sm");
+ }
if (sel->cdata->flags & SEL_CDATA_COMMONSUBEXPR)
{
fprintf(fp, "Sc");
break;
case SEL_SUBEXPR:
- sel->evaluate = (sel->refcount == 2
- ? &_gmx_sel_evaluate_subexpr_simple
- : &_gmx_sel_evaluate_subexpr);
+ if (sel->refcount == 2
+ && !(sel->cdata->flags & SEL_CDATA_STATICMULTIEVALSUBEXPR))
+ {
+ sel->evaluate = &_gmx_sel_evaluate_subexpr_simple;
+ }
+ else
+ {
+ sel->evaluate = &_gmx_sel_evaluate_subexpr;
+ }
break;
case SEL_SUBEXPRREF:
sel->name = sel->child->name;
- sel->evaluate = (sel->child->refcount == 2
+ sel->evaluate = ((sel->cdata->flags & SEL_CDATA_SIMPLESUBEXPR)
? &_gmx_sel_evaluate_subexprref_simple
: &_gmx_sel_evaluate_subexprref);
break;
}
-
+ sel->cdata->evaluate = sel->evaluate;
return TRUE;
}
}
}
- if (sel->type == SEL_SUBEXPR && sel->refcount == 2)
+ if (sel->type == SEL_SUBEXPR && sel->refcount == 2
+ && !(sel->cdata->flags & SEL_CDATA_STATICMULTIEVALSUBEXPR))
{
sel->flags &= ~(SEL_ALLOCVAL | SEL_ALLOCDATA);
if (sel->v.type == GROUP_VALUE || sel->v.type == POS_VALUE)
_gmx_selvalue_setstore(&sel->v, sel->child->v.u.ptr);
}
}
- else if (sel->type == SEL_SUBEXPRREF && sel->child->refcount == 2)
+ else if (sel->type == SEL_SUBEXPRREF
+ && (sel->cdata->flags & SEL_CDATA_SIMPLESUBEXPR))
{
if (sel->v.u.ptr)
{
init_item_staticeval(child);
}
}
+ /* If an expression is evaluated for a dynamic group, then also
+ * atom-valued parameters need to be evaluated every time. */
+ if ((sel->flags & SEL_DYNAMIC)
+ && (sel->type == SEL_EXPRESSION || sel->type == SEL_MODIFIER)
+ && (child->flags & SEL_ATOMVAL))
+ {
+ child->flags |= SEL_DYNAMIC;
+ child->cdata->flags &= ~SEL_CDATA_STATIC;
+ }
child = child->next;
}
}
}
else if (sel->type == SEL_SUBEXPRREF && sel->child->refcount == 2)
{
- sel->cdata->flags |= SEL_CDATA_SIMPLESUBEXPR;
+ /* See similar condition in init_item_staticeval(). */
+ if ((sel->flags & SEL_ATOMVAL)
+ && (sel->flags & SEL_DYNAMIC)
+ && !(sel->child->flags & SEL_DYNAMIC))
+ {
+ sel->child->cdata->flags |= SEL_CDATA_STATICMULTIEVALSUBEXPR;
+ }
+ else
+ {
+ sel->cdata->flags |= SEL_CDATA_SIMPLESUBEXPR;
+ }
}
/* Process children, but only follow subexpression references if the
break;
case SEL_SUBEXPR:
- if (sel->cdata->flags & (SEL_CDATA_SIMPLESUBEXPR | SEL_CDATA_FULLEVAL))
+ if (((sel->cdata->flags & SEL_CDATA_SIMPLESUBEXPR) &&
+ !(sel->cdata->flags & SEL_CDATA_STATICMULTIEVALSUBEXPR))
+ || (sel->cdata->flags & SEL_CDATA_FULLEVAL))
{
rc = sel->cdata->evaluate(data, sel, g);
_gmx_selvalue_setstore(&sel->v, sel->child->v.u.ptr);
sel->child->flags &= ~(SEL_ALLOCVAL | SEL_ALLOCDATA);
sel->child->v.nalloc = -1;
}
+
+ /* For static subexpressions with a dynamic evaluation group, there is
+ * no need to evaluate them again, as the SEL_SUBEXPRREF takes care of
+ * everything during evaluation. */
+ if (sel->type == SEL_SUBEXPR
+ && (sel->cdata->flags & SEL_CDATA_SIMPLESUBEXPR)
+ && (sel->cdata->flags & SEL_CDATA_STATICMULTIEVALSUBEXPR))
+ {
+ sel->evaluate = NULL;
+ sel->cdata->evaluate = NULL;
+ }
}
/* FIXME: Clean up the collection */
return -1;
}
- /* Initialize evaluation function. */
- if (!init_item_evalfunc(item))
- {
- /* FIXME: Clean up the collection */
- return -1;
- }
- setup_memory_pooling(item, sc->mempool);
/* Initialize the compiler data */
init_item_compilerdata(item);
+ item = item->next;
+ }
+ /* Initialize the static evaluation compiler flags.
+ * Requires the FULLEVAL compiler flag for the whole tree. */
+ item = sc->root;
+ while (item)
+ {
init_item_staticeval(item);
item = item->next;
}
- /* Initialize subexpression flags and evaluation output.
+ /* Initialize subexpression flags.
* Requires compiler flags for the full tree. */
item = sc->root;
while (item)
{
init_item_subexpr_flags(item);
+ item = item->next;
+ }
+ /* Initialize evaluation.
+ * Requires subexpression flags. */
+ item = sc->root;
+ while (item)
+ {
+ if (!init_item_evalfunc(item))
+ {
+ /* FIXME: Clean up the collection */
+ return -1;
+ }
+ setup_memory_pooling(item, sc->mempool);
init_item_evaloutput(item);
item = item->next;
}
while (sel)
{
/* Clear the evaluation group of subexpressions */
- if (sel->child && sel->child->type == SEL_SUBEXPR)
+ if (sel->child && sel->child->type == SEL_SUBEXPR
+ && sel->child->evaluate != NULL)
{
sel->child->u.cgrp.isize = 0;
/* Not strictly necessary, because the value will be overwritten
t_selelem *expr;
int i, j;
- if (g)
+ if (g != NULL && sel->child->evaluate != NULL)
{
int rc;
int repl_ex_nex = 0;
int nstepout = 100;
int resetstep = -1;
- int nsteps = -2; /* the value -2 means that the mdp option will be used */
+ gmx_large_int_t nsteps = -2; /* the value -2 means that the mdp option will be used */
rvec realddxyz = {0, 0, 0};
const char *ddno_opt[ddnoNR+1] =
"Keep and number checkpoint files" },
{ "-append", FALSE, etBOOL, {&bAppendFiles},
"Append to previous output files when continuing from checkpoint instead of adding the simulation part number to all file names" },
- { "-nsteps", FALSE, etINT, {&nsteps},
+ { "-nsteps", FALSE, etGMX_LARGE_INT, {&nsteps},
"Run this number of steps, overrides .mdp file option" },
{ "-maxh", FALSE, etREAL, {&max_hours},
"Terminate after 0.99 times this time (hours)" },
const char *ddcsy;
const char *ddcsz;
const char *nbpu_opt;
- int nsteps_cmdline;
+ gmx_large_int_t nsteps_cmdline;
int nstepout;
int resetstep;
int nmultisim;
const char *dddlb_opt, real dlb_scale,
const char *ddcsx, const char *ddcsy, const char *ddcsz,
const char *nbpu_opt,
- int nsteps_cmdline, int nstepout, int resetstep,
+ gmx_large_int_t nsteps_cmdline,
+ int nstepout, int resetstep,
int nmultisim, int repl_ex_nst, int repl_ex_nex, int repl_ex_seed,
real pforce, real cpt_period, real max_hours,
const char *deviceOptions, unsigned long Flags)
/* Override the value in inputrec with value passed on the command line (if any) */
static void override_nsteps_cmdline(FILE *fplog,
- int nsteps_cmdline,
+ gmx_large_int_t nsteps_cmdline,
t_inputrec *ir,
const t_commrec *cr)
{
+ char sbuf[STEPSTRSIZE];
+
assert(ir);
assert(cr);
ir->nsteps = nsteps_cmdline;
if (EI_DYNAMICS(ir->eI))
{
- sprintf(stmp, "Overriding nsteps with value passed on the command line: %d steps, %.3f ps",
- nsteps_cmdline, nsteps_cmdline*ir->delta_t);
+ sprintf(stmp, "Overriding nsteps with value passed on the command line: %s steps, %.3f ps",
+ gmx_step_str(nsteps_cmdline, sbuf),
+ nsteps_cmdline*ir->delta_t);
}
else
{
- sprintf(stmp, "Overriding nsteps with value passed on the command line: %d steps",
- nsteps_cmdline);
+ sprintf(stmp, "Overriding nsteps with value passed on the command line: %s steps",
+ gmx_step_str(nsteps_cmdline, sbuf));
}
md_print_warn(cr, fplog, "%s\n", stmp);
const char *dddlb_opt, real dlb_scale,
const char *ddcsx, const char *ddcsy, const char *ddcsz,
const char *nbpu_opt,
- int nsteps_cmdline, int nstepout, int resetstep,
+ gmx_large_int_t nsteps_cmdline, int nstepout, int resetstep,
int nmultisim, int repl_ex_nst, int repl_ex_nex,
int repl_ex_seed, real pforce, real cpt_period, real max_hours,
const char *deviceOptions, unsigned long Flags)
"REGRESSIONTEST_DOWNLOAD not supported with cmake ${CMAKE_VERSION}" FORCE)
endif()
if(REGRESSIONTEST_DOWNLOAD)
- if(NOT REGRESSIONTEST_VERSION)
- message(FATAL_ERROR "The configuration files do not specify what regressiontests tarball is suitable for automated download and testing. Please obtain and use a suitable set of tests yourself.")
+ if("${PROJECT_VERSION}" MATCHES "-dev")
+ if("${PROJECT_VERSION}" MATCHES "^5[.]")
+ set(REGRESSIONTEST_URL http://gerrit.gromacs.org/snapshot/refs/heads/master)
+ else()
+ set(REGRESSIONTEST_URL http://gerrit.gromacs.org/snapshot/refs/heads/release-4-6)
+ endif()
+ set(REGRESSIONTEST_PATH "${CMAKE_CURRENT_BINARY_DIR}/regressiontests"
+ CACHE PATH "Path to auto-downloaded regressiontests" FORCE)
+ else()
+ if(NOT REGRESSIONTEST_VERSION)
+ message(FATAL_ERROR "The configuration files do not specify what regressiontests tarball is suitable for automated download and testing. Please obtain and use a suitable set of tests yourself.")
+ endif()
+ set(REGRESSIONTEST_URL http://gerrit.gromacs.org/download/regressiontests-${REGRESSIONTEST_VERSION}.tar.gz)
+ set(REGRESSIONTEST_PATH
+ "${CMAKE_CURRENT_BINARY_DIR}/regressiontests-${REGRESSIONTEST_VERSION}"
+ CACHE PATH "Path to auto-downloaded regressiontests" FORCE)
endif()
- set(REGRESSIONTEST_URL
- http://gerrit.gromacs.org/download/regressiontests-${REGRESSIONTEST_VERSION}.tar.gz)
set(REGRESSIONTEST_FILE "${CMAKE_CURRENT_BINARY_DIR}/regressiontests.tgz")
message("Downloading: ${REGRESSIONTEST_URL}")
file(DOWNLOAD ${REGRESSIONTEST_URL} "${REGRESSIONTEST_FILE}" SHOW_PROGRESS STATUS status LOG log)
list(GET status 0 status_code)
list(GET status 1 status_string)
-
+
if(NOT status_code EQUAL 0)
message(FATAL_ERROR "error: downloading '${REGRESSIONTEST_URL}' failed
status_code: ${status_code}
log: ${log}")
endif()
- set(REGRESSIONTEST_PATH
- "${CMAKE_CURRENT_BINARY_DIR}/regressiontests-${REGRESSIONTEST_VERSION}"
- CACHE PATH "Path to auto-downloaded regressiontests" FORCE)
file(REMOVE_RECURSE "${REGRESSIONTEST_PATH}") #delete potential prior folder
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${REGRESSIONTEST_FILE}"
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")