Skip to content

Conversation

@timothy-nunn
Copy link
Contributor

@timothy-nunn timothy-nunn commented Sep 24, 2025

NOTE: this PR requires FusionComputingLab/freegs4e#47 and should probably be pinned to version 0.12+ of freegs4e.

Removes expensive deepcopies of equilibrium objects inside the evolutive loop.

The following table shows the % of the runtime for a 60 iteration example evolutive run that is spent deep copying objects.

Linear Non-linear
main (10615f0) $11.17$% $5.82$%
This PR $3.25$% $3.82$%

Overall, this results in a reduction in runtime spent in stepping.nlstepper (linear evolutive example): going from $21.12$% on main to $16.96$% on this branch.

I have compared history arrays of the coil currents, o-points, elongation, triangularity, squareness, separatrix area, and separatrix length between main and this PR. There is a 0 MAE between the non-linear example histories on main and in this PR, and a 0 MAE between the linear histories on main and in this PR.

I have confirmed that example 01, 02, 03, 04, 05, 09, and 10 can run on this branch and produce the same results as on main (the example are all non-deterministic because the RNG is not seeded but they are qualitatively similar to examples as run on main)

@kpentland kpentland self-requested a review October 6, 2025 07:38
@kpentland kpentland added enhancement New feature or request ready-for-final-tests Pull request is ready to run final pre-merge tests labels Oct 6, 2025
@timothy-nunn timothy-nunn marked this pull request as draft October 6, 2025 10:57
@timothy-nunn timothy-nunn changed the title Remove expensive deepcopies Remove expensive equilibrium deepcopying Oct 6, 2025
@timothy-nunn timothy-nunn force-pushed the remove-deepcopying branch 2 times, most recently from 2137a24 to 4d709b3 Compare October 7, 2025 10:49
@timothy-nunn timothy-nunn marked this pull request as ready for review October 7, 2025 14:04
@timothy-nunn timothy-nunn marked this pull request as draft October 7, 2025 14:04
@timothy-nunn timothy-nunn marked this pull request as ready for review October 7, 2025 14:05
@kpentland kpentland added ready-for-final-tests Pull request is ready to run final pre-merge tests and removed ready-for-final-tests Pull request is ready to run final pre-merge tests labels Oct 8, 2025
Copy link
Collaborator

@kpentland kpentland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great Tim, thanks!

I've run the examples and also tested examples 6a/b to ensure everything still works for MAST-U equilibria. Seems to be working nicely.

We'll update the freegs4e version, get the tests run, and then merge in.

@georgeholt1 georgeholt1 added the ready-for-final-tests Pull request is ready to run final pre-merge tests label Oct 8, 2025
@georgeholt1 georgeholt1 added ready-for-final-tests Pull request is ready to run final pre-merge tests and removed ready-for-final-tests Pull request is ready to run final pre-merge tests labels Oct 8, 2025
@georgeholt1 georgeholt1 merged commit 0993ebe into FusionComputingLab:main Oct 8, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request ready-for-final-tests Pull request is ready to run final pre-merge tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants