From 1566ca88d6cfecfad6f8603c0b4f1b9128bbb66d Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 1 Aug 2012 13:06:45 -0400 Subject: [PATCH] Reduce k_batch only when needed. Fixed weird NaN issue. --- src/intercycle.F90 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/intercycle.F90 b/src/intercycle.F90 index 4b6249ca49..5a47411c91 100644 --- a/src/intercycle.F90 +++ b/src/intercycle.F90 @@ -371,14 +371,16 @@ contains if (.not. tallies_on) k_batch(current_batch) = global_tallies(K_ANALOG) % value #ifdef MPI - ! Reduce value of k_batch if running in parallel - if (master) then - call MPI_REDUCE(MPI_IN_PLACE, k_batch(current_batch), 1, MPI_REAL8, & - MPI_SUM, 0, MPI_COMM_WORLD, mpi_err) - else - ! Receive buffer not significant at other processors - call MPI_REDUCE(k_batch(current_batch), temp, 1, MPI_REAL8, & - MPI_SUM, 0, MPI_COMM_WORLD, mpi_err) + if ((.not. tallies_on) .or. (.not. reduce_tallies)) then + ! Reduce value of k_batch if running in parallel + if (master) then + call MPI_REDUCE(MPI_IN_PLACE, k_batch(current_batch), 1, MPI_REAL8, & + MPI_SUM, 0, MPI_COMM_WORLD, mpi_err) + else + ! Receive buffer not significant at other processors + call MPI_REDUCE(k_batch(current_batch), temp, 1, MPI_REAL8, & + MPI_SUM, 0, MPI_COMM_WORLD, mpi_err) + end if end if #endif