Skip to content

Memory leak: w3iorsmd.F90#583

Merged
aliabdolali merged 4 commits into
NOAA-EMC:developfrom
MatthewMasarik-NOAA:bf/mem-w3iors
Jan 24, 2022
Merged

Memory leak: w3iorsmd.F90#583
aliabdolali merged 4 commits into
NOAA-EMC:developfrom
MatthewMasarik-NOAA:bf/mem-w3iors

Conversation

@MatthewMasarik-NOAA
Copy link
Copy Markdown
Contributor

@MatthewMasarik-NOAA MatthewMasarik-NOAA commented Jan 14, 2022

Pull Request Summary

Fixes memory leaks in w3iorsmd.F90.

Description

Provide a detailed description of what this PR does.

  • Fixes memory leaks in the restart module, w3iorsmd.F90, related to ALLOCATED arrays as well as OPENed file units (closing these releases associated IO buffers).
    • DEALLOCATE and CLOSE statements are added before a 'bail out' RETURN statement.
    • The same logic around the OPEN statement for the restart file unit, NDSR, is reproduced before the main RETURN statement.

What bug does it fix, or what feature does it add?

Is a change of answers expected from this PR?

  • No.

Please also include the following information:

  • Mention any labels that should be added:
    • bug
  • Are answer changes expected from this PR?
    • No. This fix passed the UFS cpld_bmark_p7 regtest, as well as matrix.comp.

Issue(s) addressed

Commit Message

w3iorsmd: fixes memory leaks

Check list

Testing

  • How were these changes tested?
    • UFS regression test cpld_bmark_p7 was run with the fix and passed.
    • The same test was also run with WW3 develop for comparison. Each of these runs had ESMF memory profiling turned on. This plot compares the mean memory use for both runs at each timestep.

cpld_bmark_p7_mean_pet

  • Lastly the full matrix was run for develop and fix. Matrix.comp returned only the expected differences for the non-identical cases.

  • Are the changes covered by regression tests? (If not, why? Do new tests need to be added?)

    • Yes. A new feature is not being added. Memory leaks were fixed, so running these changes against develop in the full matrix confirms that answers have not changed.
  • Have the matrix regression tests been run (if yes, please note HPC and compiler)?

    • Yes. Hera/Intel.
  • Please provide the summary output of matrix.comp (matrix.Diff.txt, matrixCompFull.txt and matrixCompSummary.txt):

  • Please indicate the expected changes in the regression test output (Note the known list of non-identical tests).

    • The only changes are within the list of expected differences.
  • Please provide the summary output of matrix.comp (matrix.Diff.txt, matrixCompFull.txt and matrixCompSummary.txt):

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_03/./work_PR2_UQ_MPI_d2                     (6 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (8 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (7 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (6 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (11 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (8 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (8 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (7 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (5 files differ)
ww3_ufs1.1/./work_d                     (0 files differ)
ww3_ufs1.2/./work_b                     (0 files differ)
ww3_ufs1.3/./work_a                     (1 files differ)
 
**********************************************************************
************************ identical cases *****************************
**********************************************************************

@JessicaMeixner-NOAA
Copy link
Copy Markdown
Collaborator

@aliabdolali have you run the regtests or do you need me to?

@aliabdolali
Copy link
Copy Markdown
Contributor

The regtests ran successfully with pre-known non-b4b cases:

**********************************************************************
********************* non-identical cases ****************************
**********************************************************************
mww3_test_03/./work_PR2_UQ_MPI_d2                     (8 files differ)
mww3_test_03/./work_PR2_UNO_MPI_d2                     (6 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2_c                     (8 files differ)
mww3_test_03/./work_PR1_MPI_d2                     (7 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2_c                     (8 files differ)
mww3_test_03/./work_PR3_UNO_MPI_d2                     (6 files differ)
mww3_test_03/./work_PR3_UQ_MPI_d2                     (9 files differ)
ww3_tp2.10/./work_MPI_OMPH                     (6 files differ)
ww3_tp2.16/./work_MPI_OMPH                     (4 files differ)
ww3_ufs1.1/./work_d                     (0 files differ)
ww3_ufs1.2/./work_b                     (0 files differ)
ww3_ufs1.3/./work_a                     (1 files differ)

matrixCompFull.txt
matrixCompSummary.txt
matrixDiff.txt

@aliabdolali aliabdolali merged commit a0a48ee into NOAA-EMC:develop Jan 24, 2022
@MatthewMasarik-NOAA MatthewMasarik-NOAA deleted the bf/mem-w3iors branch February 1, 2022 22:46
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.

3 participants