simplify output handling in Finish class
This commit is contained in:
@ -32,6 +32,8 @@
|
|||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "universe.h"
|
#include "universe.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "fmt/format.h"
|
||||||
|
|
||||||
#ifdef LMP_USER_OMP
|
#ifdef LMP_USER_OMP
|
||||||
#include "modify.h"
|
#include "modify.h"
|
||||||
@ -121,12 +123,9 @@ void Finish::end(int flag)
|
|||||||
|
|
||||||
if (me == 0) {
|
if (me == 0) {
|
||||||
int ntasks = nprocs * nthreads;
|
int ntasks = nprocs * nthreads;
|
||||||
const char fmt1[] = "Loop time of %g on %d procs "
|
utils::logmesg(lmp,fmt::format("Loop time of {:.6g} on {} procs for "
|
||||||
"for %d steps with " BIGINT_FORMAT " atoms\n\n";
|
"{} steps with {} atoms\n\n",time_loop,
|
||||||
if (screen) fprintf(screen,fmt1,time_loop,ntasks,update->nsteps,
|
ntasks,update->nsteps,atom->natoms));
|
||||||
atom->natoms);
|
|
||||||
if (logfile) fprintf(logfile,fmt1,time_loop,ntasks,update->nsteps,
|
|
||||||
atom->natoms);
|
|
||||||
|
|
||||||
// Gromacs/NAMD-style performance metric for suitable unit settings
|
// Gromacs/NAMD-style performance metric for suitable unit settings
|
||||||
|
|
||||||
@ -144,24 +143,20 @@ void Finish::end(int flag)
|
|||||||
|
|
||||||
if (strcmp(update->unit_style,"lj") == 0) {
|
if (strcmp(update->unit_style,"lj") == 0) {
|
||||||
double tau_day = 24.0*3600.0 / t_step * update->dt / one_fs;
|
double tau_day = 24.0*3600.0 / t_step * update->dt / one_fs;
|
||||||
const char perf[] = "Performance: %.3f tau/day, %.3f timesteps/s\n";
|
utils::logmesg(lmp,fmt::format("Performance: {:.3f} tau/day, {:.3f} "
|
||||||
if (screen) fprintf(screen,perf,tau_day,step_t);
|
"timesteps/s\n",tau_day,step_t));
|
||||||
if (logfile) fprintf(logfile,perf,tau_day,step_t);
|
|
||||||
} else if (strcmp(update->unit_style,"electron") == 0) {
|
} else if (strcmp(update->unit_style,"electron") == 0) {
|
||||||
double hrs_fs = t_step / update->dt * one_fs / 3600.0;
|
double hrs_fs = t_step / update->dt * one_fs / 3600.0;
|
||||||
double fs_day = 24.0*3600.0 / t_step * update->dt / one_fs;
|
double fs_day = 24.0*3600.0 / t_step * update->dt / one_fs;
|
||||||
const char perf[] =
|
utils::logmesg(lmp,fmt::format("Performance: {:.3f} fs/day, {:.3f} "
|
||||||
"Performance: %.3f fs/day, %.3f hours/fs, %.3f timesteps/s\n";
|
"hours/fs, {:.3f} timesteps/s\n",
|
||||||
if (screen) fprintf(screen,perf,fs_day,hrs_fs,step_t);
|
fs_day,hrs_fs,step_t));
|
||||||
if (logfile) fprintf(logfile,perf,fs_day,hrs_fs,step_t);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
double hrs_ns = t_step / update->dt * 1000000.0 * one_fs / 3600.0;
|
double hrs_ns = t_step / update->dt * 1000000.0 * one_fs / 3600.0;
|
||||||
double ns_day = 24.0*3600.0 / t_step * update->dt / one_fs/1000000.0;
|
double ns_day = 24.0*3600.0 / t_step * update->dt / one_fs/1000000.0;
|
||||||
const char perf[] =
|
utils::logmesg(lmp,fmt::format("Performance: {:.3f} ns/day, {:.3f} "
|
||||||
"Performance: %.3f ns/day, %.3f hours/ns, %.3f timesteps/s\n";
|
"hours/ns, {:.3f} timesteps/s\n",
|
||||||
if (screen) fprintf(screen,perf,ns_day,hrs_ns,step_t);
|
ns_day,hrs_ns,step_t));
|
||||||
if (logfile) fprintf(logfile,perf,ns_day,hrs_ns,step_t);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,23 +164,17 @@ void Finish::end(int flag)
|
|||||||
|
|
||||||
if (timeflag) {
|
if (timeflag) {
|
||||||
if (lmp->kokkos) {
|
if (lmp->kokkos) {
|
||||||
const char fmt2[] =
|
utils::logmesg(lmp,fmt::format("{:.1f}% CPU use with {} MPI tasks "
|
||||||
"%.1f%% CPU use with %d MPI tasks x %d OpenMP threads\n";
|
"x {} OpenMP threads\n",cpu_loop,nprocs,
|
||||||
if (screen) fprintf(screen,fmt2,cpu_loop,nprocs,
|
lmp->kokkos->nthreads));
|
||||||
lmp->kokkos->nthreads);
|
|
||||||
if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs,
|
|
||||||
lmp->kokkos->nthreads);
|
|
||||||
} else {
|
} else {
|
||||||
#if defined(_OPENMP)
|
#if defined(_OPENMP)
|
||||||
const char fmt2[] =
|
utils::logmesg(lmp,fmt::format("{:.1f}% CPU use with {} MPI tasks "
|
||||||
"%.1f%% CPU use with %d MPI tasks x %d OpenMP threads\n";
|
"x {} OpenMP threads\n",
|
||||||
if (screen) fprintf(screen,fmt2,cpu_loop,nprocs,nthreads);
|
cpu_loop,nprocs,nthreads));
|
||||||
if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs,nthreads);
|
|
||||||
#else
|
#else
|
||||||
const char fmt2[] =
|
utils::logmesg(lmp,fmt::format("{:.1f}% CPU use with {} MPI tasks "
|
||||||
"%.1f%% CPU use with %d MPI tasks x no OpenMP threads\n";
|
"x no OpenMP threads\n",cpu_loop,nprocs));
|
||||||
if (screen) fprintf(screen,fmt2,cpu_loop,nprocs);
|
|
||||||
if (logfile) fprintf(logfile,fmt2,cpu_loop,nprocs);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user