Skip to content

Repo - PERF - Cover the perturbed equilibrium, kinetic torque and Galerkin paths in the precompile workload - #678

Open
logan-nc wants to merge 3 commits into
developfrom
feature/precompile-full-chain
Open

logan-nc wants to merge 3 commits into
developfrom
feature/precompile-full-chain

Conversation

@logan-nc

@logan-nc logan-nc commented Nov 14, 2026 •

Copy link
Copy Markdown
Collaborator

Release note

  • Audience: users
  • Numerical impact: none (harness @ b066ad8)
  • Migration: none

The first full run in a fresh Julia process no longer compiles the coil forcing, the perturbed equilibrium, the kinetic torque or the Galerkin solve on first use: the package build now runs them once. On examples/DIIID-like_ideal_example the first run drops from about 48 s to about 13 s, and the first Galerkin stability run from about 24 s to about 10 s.

Regression report

regress --cases diiid_n1,diiid_n1_riccati,diiid_n1_riccati_precompiled,gal_resistive_diiid,tj_kinetic_ntv,solovev_n1 --refs origin/develop,feature/precompile-full-chain
Ref 1: origin/develop @ f11d75a0a   Ref 2: feature/precompile-full-chain @ b066ad812
env: julia 1.11.7, x86_64-linux-gnu, manifest 6f3e1b5f (pinned), 16 threads/16 BLAS

diiid_n1                         53 unchanged (jit build)
diiid_n1_riccati                 17 unchanged (jit build)
diiid_n1_riccati_precompiled     17 unchanged (aot build)
gal_resistive_diiid              11 unchanged (jit build)
tj_kinetic_ntv                   7 unchanged (jit build)
solovev_n1                       22 unchanged (jit build)

Notes for reviewers

What changed. src/Precompile.jl ran a coarse Solovev case through the Riccati and forward stability solves. It now also runs that case through the Galerkin solve (with the coil-response columns), and a coarse TJ-analytic case with kinetic profiles and DIII-D C-coil forcing through the perturbed equilibrium and the kinetic torque. The decks are built in memory and the kinetic table is written to the scratch directory, so nothing outside src/ is read.

Measured (two Xeon Gold 6330, shared, 16 threads, Julia 1.11.7; each row two fresh processes; the deck is examples/DIIID-like_ideal_example without local stability and error fields, on a fixed 128-interval grid with loose tolerances, and examples/DIIID-like_gal_resistive_example cut down to equilibrium and stability):

develop this branch
using GeneralizedPerturbedEquilibrium 11.8 to 12.7 s 12.0 to 13.9 s
first full run (equilibrium to torque) 47.0, 48.8 s 12.9, 13.2 s
of which perturbed equilibrium 13.0, 13.1 s 0.6, 0.6 s
of which kinetic torque 23.6, 25.1 s 4.1, 4.2 s
second run in the same process 5.9, 6.4 s 6.2, 6.3 s
first Galerkin stability run 23.6, 24.5 s 10.0 to 10.9 s (14.0 s in one run on a loaded machine)
later Galerkin runs 5.1 to 5.5 s 5.2 to 5.7 s

Cost. The one-time build of the package is longer: about 200 s on develop against 256, 326 and 269 s in three builds of this branch, all on a loaded shared machine, so the increase is roughly one to two minutes and not better known than that.

Results. With the workload on (the default build), the full run above returns bit-identical least-stable energy, total torque and resonant fields on develop and on this branch. The harness (workload off, plus the diiid_n1_riccati_precompiled case with it on) is unchanged.

CI on the first two commits. Two checks failed. The formatter wanted one expression wrapped differently; fixed. runtests_equil.jl:312, an exact (==) comparison of a re-formed inverse equilibrium with a freshly read one, failed in the core group, where it passes on other pull requests. The first version of the workload ran its response case through the inverse-equilibrium solver at build time, and code compiled into the package image can round differently in the last bit (docs, Developer tips). The third commit moves that case to the direct solver so the inverse path is compiled on first use as before. With the third commit every check passes. (Locally the test could not be used as a guide: on the two machines available it fails on unmodified develop as well.)

What is left. About 7 s of the first full run is still compilation: 4.4 s outside the timed stages, about 0.8 s in the equilibrium read from a g-eqdsk file (the workload uses analytic equilibria) and about 1 s in the torque. Covering the file-based equilibrium would need an equilibrium file inside src/ or a writer for one; not done here.

No new test. A workload that fails stops the package build, which every test run does first.


Opened as a draft: assignee set, reviewer to be named.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BgNxCG7pGc8HRXGZ3r3psj

logan-nc and others added 2 commits November 13, 2026 23:10
…erkin paths in the precompile workload

The workload ran a Solovev case through the Riccati and forward stability
solves only, so the first full run in a fresh process compiled the coil
forcing, the perturbed equilibrium, the kinetic torque and the Galerkin
solve on first use. Add a Galerkin pass on the Solovev case and a coarse
TJ-analytic case with kinetic profiles and C-coil forcing that runs the
response and the torque.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BgNxCG7pGc8HRXGZ3r3psj
…mpile workload

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BgNxCG7pGc8HRXGZ3r3psj
@logan-nc logan-nc self-assigned this Nov 14, 2026
@github-actions github-actions Bot added perf Same answers, less time or memory labels Nov 14, 2026
…ct equilibrium solver

The TJ-analytic case compiled the inverse-equilibrium path into the package
image, which changed the last bit of a re-formed inverse equilibrium against
a freshly read one. The direct solver leaves that path compiled on first use.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BgNxCG7pGc8HRXGZ3r3psj
@logan-nc
logan-nc requested a review from d-burg November 14, 2026 11:41
@logan-nc
logan-nc marked this pull request as ready for review November 14, 2026 11:42

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf Same answers, less time or memory

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant