Skip to content

Commit

Permalink
Fix debug mode crash for new icebergs io
Browse files Browse the repository at this point in the history
- This fixes issue #7 on NOAA-GFDL/Icebergs NOAA-GFDL/icebergs#7

  forrtl: severe (408): fort: (2): Subscript #1 of the array SBUF has value 1 which is greater than the upper bound of 0
  • Loading branch information
nikizadehgfdl committed Aug 3, 2015
1 parent 16d3182 commit cdafe97
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions mpp/include/mpp_gather.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,13 @@ subroutine MPP_GATHER_1DV_(sbuf, ssize, rbuf, rsize, pelist)


!--- pre-post receiving
if(pe == op_root) then
rbuf(1:ssize) = sbuf(:)
pos = ssize
do l = 2, nproc
call mpp_recv(rbuf(pos+1), glen=rsize(l), from_pe=pelist2(l), block=.FALSE., tag=COMM_TAG_2 )
pos = pos + rsize(l)
enddo
else
call mpp_send(sbuf(1), plen=ssize, to_pe=op_root, tag=COMM_TAG_2)
endif
pos = 1
do l = 1, nproc ! include op_root to simplify logic
if(rsize(l) == 0) cycle ! avoid ranks with no data
call mpp_recv(rbuf(pos), glen=rsize(l), from_pe=pelist2(l), block=.FALSE., tag=COMM_TAG_2 )
pos = pos + rsize(l)
enddo
if(ssize>0) call mpp_send(sbuf(1), plen=ssize, to_pe=op_root, tag=COMM_TAG_2) ! avoid ranks with no data

call mpp_sync_self(check=EVENT_RECV)
call mpp_sync_self()
Expand Down

0 comments on commit cdafe97

Please sign in to comment.