Skip to content

[WIP] Reduce Rosenbrock memory usage#2016

Draft
BenWibking wants to merge 4 commits into
AMReX-Astro:developmentfrom
BenWibking:reuse-rosenbrock-stages
Draft

[WIP] Reduce Rosenbrock memory usage#2016
BenWibking wants to merge 4 commits into
AMReX-Astro:developmentfrom
BenWibking:reuse-rosenbrock-stages

Conversation

@BenWibking

@BenWibking BenWibking commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Reduce memory usage for Rodas5P by re-using work arrays in a non-trivial way:

  • While the final update does require all previous stages, we can save memory by only saving the linear combinations of previous stages that are re-used by later stages. This reduces the work array usage to the high-water mark of the number of linear combinations of previous stages that are needed at any given time.
  • The total number of state arrays needed in rosenbrock_t is reduced 9 arrays to 5 arrays (including the input/output state arrays).

Unfortunately, the code to do this is quite ugly. This PR is still marked "WIP" while I figure out how to make it simpler.

This only reduces memory usage for Rodas5P.

@BenWibking BenWibking changed the base branch from main to development June 8, 2026 16:12
@BenWibking BenWibking changed the title [WIP] Reuse rosenbrock stages [WIP] Reuse Rosenbrock stages Jun 8, 2026
@BenWibking BenWibking changed the title [WIP] Reuse Rosenbrock stages [WIP] Reduce Rosenbrock memory usage Jun 8, 2026
@BenWibking

Copy link
Copy Markdown
Collaborator Author

This changes the answers due to floating-point reassociativity differences. Trace species below atol_spec change more significantly.

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.

1 participant