From afe12114c3d79d9faf4888673564c732476d3a1e Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 26 Apr 2012 18:39:43 -0400 Subject: [PATCH] Fixed minor bug in fission bank algorithm. --- src/intercycle.F90 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/intercycle.F90 b/src/intercycle.F90 index 4d954be18f..d19297fdfa 100644 --- a/src/intercycle.F90 +++ b/src/intercycle.F90 @@ -186,11 +186,11 @@ contains index_local = 1 n_request = 0 - SEND_SITES: do while (start < finish) - ! Determine the index of the processor which has the first part of the - ! source_bank for the local processor - neighbor = start / maxwork + ! Determine the index of the processor which has the first part of the + ! source_bank for the local processor + neighbor = start / maxwork + SEND_SITES: do while (start < finish) ! Determine the number of sites to send n = min((neighbor + 1)*maxwork, finish) - start @@ -206,6 +206,11 @@ contains start = start + n index_local = index_local + n neighbor = neighbor + 1 + + ! Check for sites out of bounds -- this only happens in the rare + ! circumstance that a processor close to the end has so many sites that + ! it would exceed the bank on the last processor + if (neighbor > n_procs - 1) exit end do SEND_SITES ! ========================================================================== @@ -255,7 +260,7 @@ contains neighbor = neighbor + 1 end do RECV_SITES - ! Send we initiated a series of asynchronous ISENDs and IRECVs, now we have + ! Since we initiated a series of asynchronous ISENDs and IRECVs, now we have ! to ensure that the data has actually been communicated before moving on to ! the next generation