Skip to content
Snippets Groups Projects
Commit 78498715 authored by Tim Mattox's avatar Tim Mattox
Browse files

Protect from divide by zero in mpi_timings() when printing results.

e.g. If neighbor list(s) are never rebuilt, the Neigh time will be zero.
parent c31f1e9f
No related branches found
No related tags found
No related merge requests found
...@@ -912,7 +912,7 @@ void mpi_timings(const char *label, Timer *t, enum Timer::ttype tt, ...@@ -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_sq/time - time) > 1.0e-10) if ((time > 0.0) && ((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, ...@@ -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_std/time_avg -time_avg) > 1.0e-10) if ((time_avg > 0.0) && ((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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment