Skip to content

Commit

Permalink
Bug fix and small simplification/optimization change (#18)
Browse files Browse the repository at this point in the history
* Fixes NOAA-EMC#290 (ww3_multi hanging when generating restart with IOSTYP >= 2)
* Also fixes out-of-bounds array access error.
* Includes some MPI optimizations
  • Loading branch information
ukmo-juan-castillo authored Mar 4, 2021
1 parent 8b725a5 commit 6930fac
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
9 changes: 2 additions & 7 deletions model/ftn/w3iorsmd.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@
!
!/MPI ALLOCATE ( STAT1(MPI_STATUS_SIZE,NRQ) )
!/MPI IF ( IAPROC .EQ. NAPRST ) CALL MPI_STARTALL &
!/MPI ( NRQ, IRQRSS, IERR_MPI )
!/MPI ( NRQ*NBLKRS, IRQRSS, IERR_MPI )
!
!/MPI DO IB=1, NBLKRS
!/MPI ISEA0 = 1 + (IB-1)*RSBLKS*NAPROC
Expand All @@ -595,11 +595,6 @@
!/MPI IH = 1 + NRQ * (IB-1)
!/MPI CALL MPI_WAITALL &
!/MPI ( NRQ, IRQRSS(IH), STAT1, IERR_MPI )
!/MPI IF ( IB .LT. NBLKRS ) THEN
!/MPI IH = 1 + NRQ * IB
!/MPI CALL MPI_STARTALL &
!/MPI ( NRQ, IRQRSS(IH), IERR_MPI )
!/MPI END IF
!
!/MPI DO ISEA=ISEA0, ISEAN
!/MPI NREC = ISEA + 2
Expand All @@ -609,7 +604,7 @@
!/MPI IF ( IP .EQ. NAPRST ) THEN
!/MPI WRITEBUFF(1:NSPEC) = VA(1:NSPEC,JSEA)
!/MPI ELSE
!/MPI JSEA = JSEA - 2*((IB-1)/2)*RSBLKS
!/MPI JSEA = 1 + MOD(IB-1,2)*RSBLKS
!/MPI WRITEBUFF(1:NSPEC) = VAAUX(1:NSPEC,JSEA,IP)
!/MPI END IF
!/MPI WRITE (NDSR,POS=RPOS,ERR=803,IOSTAT=IERR) &
Expand Down
2 changes: 1 addition & 1 deletion model/ftn/w3odatmd.ftn
Original file line number Diff line number Diff line change
Expand Up @@ -1591,9 +1591,9 @@
!/MPI RSBLKS => OUTPTS(IMOD)%OUT4%RSBLKS
!/MPI IF ( NRQRS .NE. 0 ) THEN
!/MPI IRQRS => OUTPTS(IMOD)%OUT4%IRQRS
!/MPI IRQRSS => OUTPTS(IMOD)%OUT4%IRQRSS
!/MPI VAAUX => OUTPTS(IMOD)%OUT4%VAAUX
!/MPI END IF
!/MPI IRQRSS => OUTPTS(IMOD)%OUT4%IRQRSS
!
NBI => OUTPTS(IMOD)%OUT5%NBI
NBI2 => OUTPTS(IMOD)%OUT5%NBI2
Expand Down
4 changes: 2 additions & 2 deletions regtests/mww3_test_04/input/ww3_multi_grdset_d.inp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $
19680606 000000 1200 19680608 000000
$
N
DPT CUR HS FP DP DIR SPR
DPT CUR HS FP DP DIR SPR WND UST LM
$
19680606 000000 3600 19680608 000000
-100.E3 50.E3 'A1'
Expand Down Expand Up @@ -43,7 +43,7 @@ $
0.E3 0.E3 'STOPSTRING'
$
19680606 000000 0 19680608 000000
19680606 011200 0 19680606 011200
19680606 020000 3600 19680606 020000
19680606 000000 0 19680608 000000
19680606 000000 0 19680608 000000
$
Expand Down
3 changes: 2 additions & 1 deletion regtests/mww3_test_04/input/ww3_multi_grdset_d.nml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
! ITYPE(3)%TRACK%FORMAT = F
! -------------------------------------------------------------------- !
&OUTPUT_TYPE_NML
ALLTYPE%FIELD%LIST = 'DPT CUR HS FP DP DIR SPR'
ALLTYPE%FIELD%LIST = 'DPT CUR HS FP DP DIR SPR WND UST LM'
ALLTYPE%POINT%NAME = 'points'
ALLTYPE%POINT%FILE = '../input/points.list'
/
Expand Down Expand Up @@ -208,6 +208,7 @@
&OUTPUT_DATE_NML
ALLDATE%FIELD = '19680606 000000' '1200' '19680608 000000'
ALLDATE%POINT = '19680606 000000' '3600' '19680608 000000'
ALLDATE%RESTART = '19680606 020000' '3600' '19680606 020000'
/

! -------------------------------------------------------------------- !
Expand Down

0 comments on commit 6930fac

Please sign in to comment.