switch to using wall time

This commit is contained in:
Axel Kohlmeyer
2022-05-06 16:58:28 -04:00
parent 6e78269612
commit 907bc7eaa5
2 changed files with 13 additions and 13 deletions

View File

@ -425,15 +425,15 @@ python-style variable can be used in place of an equal-style variable
anywhere in an input script, e.g. as an argument to another command anywhere in an input script, e.g. as an argument to another command
that allows for equal-style variables. that allows for equal-style variables.
For the *timer* style no additional argument is specified. The value For the *timer* style no additional argument is specified. The value of
of the variable is set by querying the current elapsed CPU time of the the variable is set by querying the current elapsed wall time of the
simulation. This is done at the point in time the variable is defined simulation. This is done at the point in time when the variable is
in the input script. If a second timer-style variable is also defined in the input script. If a second timer-style variable is also
defined, then a simple formula can be used to calculate the elapsed defined, then a simple formula can be used to calculate the elapsed time
time between the two timers, as in the example above. As mentioned between the two timers, as in the example at the top of this manual
above, timer-style variables can be redefined elsewhere in the input entry. As mentioned above, timer-style variables can be redefined
script, so the same pair of variables can be used in a loop or to time elsewhere in the input script, so the same pair of variables can be used
a series of operations. in a loop or to time a series of operations.
For the *internal* style a numeric value is provided. This value will For the *internal* style a numeric value is provided. This value will
be assigned to the variable until a LAMMPS command sets it to a new be assigned to the variable until a LAMMPS command sets it to a new

View File

@ -501,10 +501,10 @@ void Variable::set(int narg, char **arg)
} }
// TIMER // TIMER
// stores current MPI_Wtime() as a string // stores current walltime as a timestamp in seconds
// replace pre-existing var if also style TIMER (allows reset with current time) // replace pre-existing var if also style TIMER (allows reset with current time)
// num = 1, for string representation of dvalue, set by retrieve() // num = 1, for string representation of dvalue, set by retrieve()
// dvalue = numeric initialization via platform::cputime() // dvalue = numeric initialization via platform::walltime()
} else if (strcmp(arg[1],"timer") == 0) { } else if (strcmp(arg[1],"timer") == 0) {
if (narg != 2) error->all(FLERR,"Illegal variable command"); if (narg != 2) error->all(FLERR,"Illegal variable command");
@ -512,7 +512,7 @@ void Variable::set(int narg, char **arg)
if (ivar >= 0) { if (ivar >= 0) {
if (style[ivar] != TIMER) if (style[ivar] != TIMER)
error->all(FLERR,"Cannot redefine variable as a different style"); error->all(FLERR,"Cannot redefine variable as a different style");
dvalue[ivar] = platform::cputime(); dvalue[ivar] = platform::walltime();
replaceflag = 1; replaceflag = 1;
} else { } else {
if (nvar == maxvar) grow(); if (nvar == maxvar) grow();
@ -522,7 +522,7 @@ void Variable::set(int narg, char **arg)
pad[nvar] = 0; pad[nvar] = 0;
data[nvar] = new char*[num[nvar]]; data[nvar] = new char*[num[nvar]];
data[nvar][0] = new char[VALUELENGTH]; data[nvar][0] = new char[VALUELENGTH];
dvalue[nvar] = platform::cputime(); dvalue[nvar] = platform::walltime();
} }
// INTERNAL // INTERNAL