Skip to content

General changes for optimization and scalability - #109

Draft
TmsRC wants to merge 19 commits into
mainfrom
optimize-updated
Draft

General changes for optimization and scalability#109
TmsRC wants to merge 19 commits into
mainfrom
optimize-updated

Conversation

@TmsRC

@TmsRC TmsRC commented Aug 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements a series of memory and compute optimizations to allow for larger grids and faster execution times. Depends on updated version of freegs4e (pull request #61).

  • Optimizes the construction of the NKGSsolver Green's function and implements a new batched strategy for computing it; exposes an option to the user to avoid caching this structure in memory.
  • Exposes options to the user for selecting type of solver, including the new, faster DST solver.
  • Optimizes the way Myy is created, allows the user to avoid caching of Myy, as well as offering an FFT version of Myy.dot() that uses even less memory.
  • Makes use of the updated freegs4e API in PR#61

Performance

Using example 02, at 513x1025, tolerance 1e-08

Caching? Original time Original RSS New LU serial DST serial LU 64 threads DST 64 threads LU RSS DST RSS
Yes 467s 30.5GB 334s 294s 95s 54s 19.3GB 16.0GB
No --- --- test pending test pending 276s 231s 8.0GB 5.4GB

Using example 05a, tolerance 1e-08, 40 steps, 64 threads, using DST solver, cached Green's function

Testcase Original time Original RSS Cached Myy time Cached Myy RSS OTF Myy time OTF Myy RSS
257x513 546s 350GB 311s 12GB 299s 4.3GB
513x1025 --- --- 1133s 132GB 1033s 30GB
  • Maximum resolution successfully tested for a static solve: 2049x4097, 1h56m, 163GB
  • Maximum resolution successfully tested for an evolutive solve: 1025x2049, 1h36m, 286GB

Special considerations

A possible oversubscription issue was identified where multiprocessing is used for parallelism (currently only in nonlinear_solve.py) due to unmanaged contention with the threads from freegs4e.parallel. The issue should only show itself when cache_greens=False is set during NKGSsolver initialization and that solver is used for linearized evolution (this combination should be discouraged regardless). An issue will be opened for this bug once this pull request is merged.

Verification

Merge checks failing due to dependence on updated freegs4e. Verification stats below contingent on the corresponding freegs4e pull request.

  • New tests added, new parametrizations added to existing tests, to evaluate new features
  • Passing all tests save for the 2 mentioned below.
  • The test for linearized growth rate (test_dynamics.py) fails for second order solvers, meaning it doesn't pass with DST: marked as xfail. It is recommended that the test is checked.
  • The test test_static_solve() in test_static_solver.py fails when the second order multigrid solver is used. No attempt has been made at resolving the issue as support for multigrid solvers is planned to be abandoned: marked as xfail. Issue will be addressed at a later point.

@TmsRC TmsRC changed the title Optimize updated General changes for optimization and scalability Aug 20, 2026
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