Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto-format fixes for develop #804

Merged
merged 6 commits into from
Sep 26, 2022

Conversation

DeniseWorthen
Copy link
Contributor

@DeniseWorthen DeniseWorthen commented Sep 22, 2022

Pull Request Summary

Updates required modules to allow auto-formatting to complete without error or other line change.

Description

  • converts do N ... N Continue to do N ... end do.
  • adds missing pounded ifdefs for W3_SHRD and W3_MPI
  • adds name association at end subroutine and end module

The fixes are identified first by having emacs attempt to auto-indent. For this PR, the initial auto-format was carried out in batch mode using emacs

 emacs --batch FILENAME.F90 -f mark-whole-buffer -f f90-indent-subprogram -f save-buffer

Failures are the reported as, for example

END DO does not match IF.
END SUBROUTINE does not match IF

Each failure must then be found and resolved manually.

Issue(s) addressed

fixes #796

Commit Message

Fixes to allow auto-formatting

co-author @mvertens

Check list

Testing

  • Auto-formatting successfully completes w/o error for all files in src, PDLIB and SCRIP subdirectories. A test branch then had the auto-formatting applied and the resultant PR include whitespace only changes.
  • Matching changes were made in the dev/ufs-weather-model branch and all wave regression tests for hera.intel/gnu and cheyenne.intel/gnu were run. All baselines passed.

@DeniseWorthen
Copy link
Contributor Author

@MatthewMasarik-NOAA @JessicaMeixner-NOAA This is the first 5 files which need changes to allow the auto-format. Before I go any further, I wanted to make sure that these changes will be acceptable.

The next batch would contain similar changes to w3snl4md, w3strkmd, w3tidemd, w3updtmd.

@JessicaMeixner-NOAA
Copy link
Collaborator

@DeniseWorthen These changes would be acceptable.

@DeniseWorthen
Copy link
Contributor Author

DeniseWorthen commented Sep 23, 2022

@JessicaMeixner-NOAA @MatthewMasarik-NOAA In wmwavemd.F90 there are multiple instances of an END IF appearing which matches an IF()THEN in either a preceding W3_MPI or W3_SHRD. I've resolved those, but there still appears to be an issue w/ wmwavemd.F90 which breaks auto-formatting and which I cannot resolve.

I've attached the auto-formatted wmwavemd.F90 here (gzipped so I can attach).

The issue appears starting at LN 1329, in the section of code "! 9.d Process unified point output for selected grid". The problem in the commented out section arises at LN 1373

#ifdef W3_MPI
                        ELSE IF ( FLG_O1 ) THEN
#endif

This line is a problem because it cannot be enclosed by any matching "if-endif". LNS 1332-1372 appear correct---there is a matching END IF for both the IF (UNIPTS) and IF (FLG_02). The preceding if (FLG_O1) at LN 1264 has been closed by the END IF at LN 1328.

Here is the relevant section.

                   END IF ! IF ( FLG_O1 )
                            !
                            ! 9.d Process unified point output for selected grid
                            !
                            IF ( UNIPTS ) THEN
                               IF ( FLG_O2 ) THEN
                                  CALL W3SETO ( I, MDSE, MDST )
                                  !
#ifdef W3_MPI
                                  IF ( NRQPO.NE.0 ) CALL MPI_STARTALL      &
                                       ( NRQPO, IRQPO1, IERR_MPI )
#endif
                                  !
                                  IF ( NOPTS.NE.0 .AND. IAPROC.EQ.NAPPNT ) THEN
                                     CALL W3SETG ( I, MDSE, MDST )
                                     CALL W3SETA ( I, MDSE, MDST )
                                     CALL W3IOPE ( VA )
                                  END IF
                                  !
#ifdef W3_MPI
                                  IF ( NRQPO .NE. 0 ) THEN
                                     ALLOCATE ( STATUS(MPI_STATUS_SIZE,NRQPO) )
                                     CALL MPI_WAITALL                      &
                                          ( NRQPO, IRQPO1, STATUS, IERR_MPI )
                                     DEALLOCATE ( STATUS )
                                  END IF
#endif
                                  !
#ifdef W3_T
                                  WRITE (MDST,9092) NOPTS
#endif
                                  !
                               END IF ! IF ( FLG_O2 )
                               !
                            END IF ! IF ( UNIPTS )
                            !
#ifdef W3_MPRF
                            CALL PRTIME ( PRFTN )
                            WRITE (MDSP,991) PRFT0, PRFTN,get_memory(),      &
                                 'ST07', I
#endif
                            !
                            ! 9.e Update TOUTP outside communicator
                            !
#ifdef W3_MPI
                         ELSE IF ( FLG_O1 ) THEN
#endif
                            !
#ifdef W3_MPI
                            CALL W3SETO ( I, MDSE, MDST )
                            CALL W3SETW ( I, MDSE, MDST )
#endif
                            !
#ifdef W3_MPI
                            TIME       = TOUTP(:,I)
                            TOUTP(1,I) = -1
                            TOUTP(2,I) =  0
#endif

wmwavemd.F90.gz

@JessicaMeixner-NOAA
Copy link
Collaborator

@DeniseWorthen I've looked at this and don't have a quick answer but will continue to look into this to see if I can't figure this out.

@DeniseWorthen DeniseWorthen changed the title first batch of auto-format fixes for develop auto-format fixes for develop Sep 25, 2022
@DeniseWorthen DeniseWorthen marked this pull request as ready for review September 25, 2022 15:32
@JessicaMeixner-NOAA
Copy link
Collaborator

@DeniseWorthen thank you so much for this PR. I see no issues when reviewing the code and have started the standalone regression tests. Should get results back by tomorrow morning if not before.

Copy link
Collaborator

@JessicaMeixner-NOAA JessicaMeixner-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @DeniseWorthen and @mvertens for these fixes!

Expected diffs in WW3 standalone regression tests:

mww3_test_03/./work_PR1_MPI_e                     (1 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (16 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (20 files differ)
mww3_test_03/./work_PR2_UQ_MPI_d2                     (15 files differ)
mww3_test_03/./work_PR3_UQ_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_e_c                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (18 files differ)
mww3_test_03/./work_PR2_UNO_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (17 files differ)
mww3_test_03/./work_PR2_UQ_MPI_e                     (1 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (15 files differ)
ww3_ta1/./work_UPD0F_U                     (0 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (7 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (4 files differ)
ww3_tp2.17/./work_mb                     (1 files differ)
ww3_tp2.17/./work_b                     (1 files differ)
ww3_tp2.17/./work_mc                     (1 files differ)
ww3_tp2.17/./work_a                     (1 files differ)
ww3_tp2.17/./work_c                     (1 files differ)
ww3_tp2.17/./work_ma                     (1 files differ)
ww3_tp2.17/./work_mc1                     (1 files differ)
ww3_tp2.17/./work_ma1                     (1 files differ)
ww3_ufs1.3/./work_a                     (1 files differ)

matrixCompFull.txt
matrixCompSummary.txt
matrixDiff.txt

@JessicaMeixner-NOAA JessicaMeixner-NOAA merged commit 6b630ed into NOAA-EMC:develop Sep 26, 2022
@DeniseWorthen DeniseWorthen deleted the feature/devpr1 branch November 3, 2022 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updates to that prohibit automatic white space changes
2 participants