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

Deallocate all the assigned memory in one go when MODFLOW finalizes #2156

Merged
merged 4 commits into from
Jan 23, 2025

Conversation

Manangka
Copy link
Contributor

@Manangka Manangka commented Jan 22, 2025

To optimize the deallocation of variables when MODFLOW finalizes, this PR moves the responsibility of deallocation to a single method instead of having the responsibility per package.

Add the moment the responsibility is moved away from the packages by simply having the mem_deallocate return immediately. In the end the entire mem_deallocate method should be removed

@mjr-deltares provided a test-case to stress test the deallocation of variables.
The test case consist of 1521820 variables and a single timestep.
The time from start to till completion of the solution is about 5 seconds. The remainder of the time is spent finalizing the simulation.

The total time spent running the simulation is:

Current deallocation New deallocation
Total time 5m42 0m22

Checklist of items for pull request

  • Replaced section above with description of pull request
  • Closed issue #xxxx
  • Referenced issue or pull request #xxxx
  • Added new test or modified an existing test
  • Ran ruff on new and modified python scripts in .doc, autotests, doc, distribution, pymake, and utils subdirectories.
  • Formatted new and modified Fortran source files with fprettify
  • Added doxygen comments to new and modified procedures
  • Updated meson files, makefiles, and Visual Studio project files for new source files
  • Updated definition files
  • Updated develop.tex with a plain-language description of the bug fix, change, feature; required for changes that may affect users
  • Updated input and output guide
  • Removed checklist items not relevant to this pull request

For additional information see instructions for contributing and instructions for developing.

@Manangka Manangka requested a review from mjr-deltares January 22, 2025 12:31
@Manangka Manangka marked this pull request as ready for review January 23, 2025 10:03
@Manangka Manangka merged commit 2fb2872 into MODFLOW-USGS:develop Jan 23, 2025
20 checks passed
@Manangka Manangka mentioned this pull request Jan 24, 2025
12 tasks
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.

2 participants