Skip to content

Major changes for optimization - #61

Open
TmsRC wants to merge 25 commits into
mainfrom
optimize-updated
Open

Major changes for optimization#61
TmsRC wants to merge 25 commits into
mainfrom
optimize-updated

Conversation

@TmsRC

@TmsRC TmsRC commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add a parallel computing library offering parallel versions of the most performance critical functions lacking native parallelism
  • Add optimization options to gradshafranov.Greens() and re-implement with parallelized functions
  • Create a separate linear solver submodule: include a frequency-space DST linear solver, optimize creation of 4th order sparse LU solver, create unified API for all linear solvers
  • Remove redundant creation of linear solver from freegs4e.equilibrium.Equilibrium(), a dummy attribute is added to preserve compatibility with freegsnke

Performance

Some illustrative results when testing on example 02:

  • At 513x1025, creation of the sparse operator goes from 36s to 0.24s
  • Equilibrium initialization at 513x1025 goes from 98s to 31s
  • At 1025x2049 a 14x speedup for NKGSsolver call to Greens() on 64 threads
  • Single solve at 1025x2049 goes from 1.3s with LU solver to 0.21s with DST

More detailed results in pull request for changes in freegnske (PR #109)

Special Considerations

The removal of solver from freegs4e.equilibrium should be the only potentially breaking change introduced. It should be completely backwards compatible with freegsnke, given that this solver was not being used, but will send deprecation warnings on some references that are made to the (dummy) solver attribute of the equilibrium. It will only cause an error if a user tries to call the solver in Equilibrium objects directly (which could but should not be the case).

This PR is needed for PR #109 in freegsnke, but not viceversa: this PR should be completely interoperable with the current version of freegsnke main branch.

Validation

  • New tests for parallel library added
  • All tests new and old passing save for those mentioned below
  • test_one_xpoint() and test_fixed_boundary_psi() are failing both on this version and main
  • test_setSolverVcycle() and test_equilibrium_geqdsk_write_read() fail now due to removal of unnecessary solver from Equilibrium. It is recommended that the test for vcycle be removed.
  • test_readwrite() fails due to removal of solver, but is also failing in main due to an independent reason
  • Tests for freegsnke main branch all passing

this pull request modifies all failed tests above by marking them as xfails

TmsRC added 24 commits August 18, 2026 10:15
@TmsRC
TmsRC marked this pull request as ready for review August 20, 2026 14:12
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