Opened 17 years ago
Closed 17 years ago
#207 closed bug (Fixed)
FLT_TEST with MPI, invalid value of ng
Reported by: | m.hadfield | Owned by: | arango |
---|---|---|---|
Priority: | minor | Milestone: | Release ROMS/TOMS 3.2 |
Component: | Nonlinear | Version: | 3.2 |
Keywords: | Cc: |
Description
When I run the FLT_TEST case with MPI enabled and in debug mode (compiler is G95), it hits an out-of-bounds error in subroutine wclock_on.
The stack trace is
At line 45 of file timers.f90 Traceback: (Innermost first) Called from line 330 of file distribute.f90 Called from line 262 of file inp_par.f90 Called from line 94 of file ocean_control.f90 Called from line 97 of file master.f90 Fortran runtime error: Array element out of bounds: 2 in (1:1), dim=3
The offending line is in subroutine wclock_on (source file timers.f90):
Cstr(region,MyModel,ng)=my_wtime(wtime)
and the problem is that ng is equal to 2, which is out of bounds for array Cstr. The value of ng = 2 is being passed to this routine by subroutine mp_bcasti_s (file distribute.f90), which is passed it by subroutine inp_par (file inp_par.f90).
Here is the block of code in inp_par where mpi_bcasti_s is called (via the interface mp_bcasti):
! !----------------------------------------------------------------------- ! Check C-preprocessing options and definitions. !----------------------------------------------------------------------- ! IF (Master) THEN CALL checkdefs CALL my_flush (out) END IF CALL mp_bcasti (ng, model, exit_flag, 1) IF (exit_flag.ne.NoError) RETURN
In subroutine inp_par there are several loops of the form
DO ng=1,Ngrids ... END DO
but this block of code is not inside one of these loops, so ng is left with the value it had on exit from the previous loop, ie Ngrids+1.
So I presume the solution is to wrap this in a loop
CALL mp_bcasti (ng, model, exit_flag, 1)
Yes, I found this one today too. The logic here is somewhat different since it is independent of nested grid structure. We need to have the following statement instead: