avoid not only division by zero, but also computing variance for short runs with insufficient resolution

This commit is contained in:
Axel Kohlmeyer 2017-01-13 14:35:35 -05:00
parent aa0b327f7e
commit 61cff85435
1 changed files with 2 additions and 2 deletions

View File

@ -912,7 +912,7 @@ void mpi_timings(const char *label, Timer *t, enum Timer::ttype tt,
time_cpu = tmp/nprocs*100.0; time_cpu = tmp/nprocs*100.0;
// % variance from the average as measure of load imbalance // % variance from the average as measure of load imbalance
if ((time > 0.0) && ((time_sq/time - time) > 1.0e-10)) if ((time > 0.001) && ((time_sq/time - time) > 1.0e-10))
time_sq = sqrt(time_sq/time - time)*100.0; time_sq = sqrt(time_sq/time - time)*100.0;
else else
time_sq = 0.0; time_sq = 0.0;
@ -964,7 +964,7 @@ void omp_times(FixOMP *fix, const char *label, enum Timer::ttype which,
time_std /= nthreads; time_std /= nthreads;
time_total /= nthreads; time_total /= nthreads;
if ((time_avg > 0.0) && ((time_std/time_avg -time_avg) > 1.0e-10)) if ((time_avg > 0.001) && ((time_std/time_avg -time_avg) > 1.0e-10))
time_std = sqrt(time_std/time_avg - time_avg)*100.0; time_std = sqrt(time_std/time_avg - time_avg)*100.0;
else else
time_std = 0.0; time_std = 0.0;