Repository navigation
Skip running-integral rules for equations without Integrals - #728
Merged
Merged
Conversation
generate_finite_difference_rules built the cumulative Euler integral rules at every grid point; each is O(index) symbolic terms, so symbolic_discretize was quadratic in the grid size even for equations without integrals. weno_burgers1d_large (4000 points): warm symbolic_discretize 1.79 s / 1602 MiB -> 0.059 s / 27 MiB. Equation sets are identical before and after on small grids. Agent-Harness: Claude Code 2.1.309 Agent-Model: claude-sonnet-5-5 Agent-Session: 47ff55ef-8952-4078-8e4e-77c72c85d6c4 Agent-Review: unreviewed Co-authored-by: Claude Code <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
generate_finite_difference_rulesbuilt the cumulative Euler integral rules (generate_euler_integration_rules) at every grid point, whether or not the equation contains anIntegral. Each rule is a recursive trapezoid sum with O(index) symbolic terms, sosymbolic_discretizewas quadratic in the grid size. On the 4000-point WENO Burgers corpus system this was 97% of the warm profile.Fix
Build those rules only when the equation contains an
Integral(has_integral(pde)). A rule keyed on anIntegralcall cannot match an equation without one, so the equation set is unchanged.Tests
GROUP=Components,GROUP=QA,GROUP=Integrals,GROUP=MOL_Interface2andGROUP=Discretizationpass (the Integral groups keep their existing Broken markers).symbolic_discretizeare byte-identical before and after on six small systems, including a cumulative-Integral PDE.Numbers
Warm
symbolic_discretize, weno_burgers1d_large (n = 4000), ModelingToolkit master:Warm
discretizefor the same system goes from 3.53 s / 4.1 GB to 1.81 s / 2.5 GB; the remainder isDAEProblemconstruction in ModelingToolkit. Other corpus systems (brusselator2d, heat3d, grayscott2d) are unchanged; their warmsymbolic_discretizewas already milliseconds.Review notes
has_integralassumes an Integral rule can only fire if anIntegralcall appears inpde.lhsorpde.rhs; if some transformation introduced integrals after this point, those rules would now be missing. The Integral-bearing test groups above pass. The staggeredgenerate_finite_difference_rulesmethod has no integral rules and is untouched.🤖 Posted by an AI agent · harness: Claude Code 2.1.309 · model: claude-sonnet-5-5
Review: unreviewed
Session: 47ff55ef-8952-4078-8e4e-77c72c85d6c4