Repository navigation
perf: faster tension-only line steps; refactor the junction tangent after an unfactored exit - #19
Merged
Merged
Conversation
Profiling the release build found about 10 % of a tension-only line step in work that repeats itself every Newton evaluation: the element kernels of the line loads re-validated, element by element, section data the line model validates when it is set; the Froude-Krylov and added-mass kernels checked the same section scalars three times and blanked their message strings about ten times per element; the zero velocity Jacobians of the Froude-Krylov and buoyancy loads were added into the band; the consistent-mass band was assembled again although it depends only on the connectivity, the free DOFs, the lengths and the masses per length; the Newton solve rescanned a band and a factor just checked finite; and the workspace helpers blanked messages on every call. The kernels take an optional inputs_validated, as the component-wave kinematics already do, which the line model passes after its own check of the state; public callers keep the full validation. The two kernels share private helpers that form the unit tangent once. The mass band is reused while its inputs are unchanged, compared exactly, and every other writer of the band clears the reuse. Every input error is reported as before, with the same message. With gfortran every output of the 52 example decks is byte-identical, with one thread and with the default. With the release build, als_volturnus_line_break_time runs 13 % faster, chain_range_tdp 16 %, spar_pinned_rods 13 % and rod_moored_spar 12 %. There, three output files differ by at most 8.6e-7 of their column maximum, and the line-break deck amplifies that difference after the break by as much as gfortran and IFX builds of the unchanged code differ. New tests check the trusted kernels bit for bit against the validating ones and that the reused mass band equals a fresh assembly. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
The monolithic body and point coupling queries each tension-only line step for its condensed end tangent, back-solving with the step's last factorization, and a warm re-solve of the same step starts from that factor. Two flags (factored_now, step_factor) mark that eff_band and ipiv hold that LU. A fresh tangent evaluation overwrote eff_band before it was factored, but the flags stayed set: a step that ended right there, accepted within the near-tolerance allowance at its iteration limit or converged on the fresh tangent, left the end query and a warm re-solve to back-solve with an unfactored matrix. A unit test steps a line with two free nodes and one Newton iteration to the allowance exit: the end tangent was off by 2.3e5 relative to the same iterate reached through an ordinary exit, and the end map by 1.5e6; with the flags cleared at the evaluation they agree to 1.8e-11 and 1.2e-10, because the end query factors the current tangent. On every other path the flags end as before. No example deck takes this path: the outputs of all 52 are byte-identical. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
…ract The CHANGELOG entry of the junction tangent fix now names the extra assembly and factorization of a junction step that exits on a fresh tangent instead of claiming no deck takes the path, and the comment on the skipped kernel input scans states that every writer of the validated fields must validate them. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
case_workspace_mass_band_follows_inputs compared every step through the shared workspace with the same step through a fresh one, which a cache that never hits also passes. The workspace now counts the steps that reuse the remembered mass band (mb_hits, a saturating test-only diagnostic that no result depends on), and each step of the test states whether it must hit: the repeated step and the repeats after a new rho_a, a new free list and an initial-acceleration solve hit; the first step and every change of l0, rho_a or the free list miss. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Owner
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
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.
Summary
EI = 0 (tension-only) line steps run 12–16 % faster, and a stale-factor bug in the junction tangent is fixed.
Speed-up
Profiling the release build found about 10 % of a tension-only line step in work that repeats every Newton evaluation:
Changes:
inputs_validated(as the component-wave kinematics already do), which the line model passes after its own state check. Public callers keep the full validation, and every input error is reported as before with the same message.chain_range_tdpals_volturnus_line_break_timespar_pinned_rodsrod_moored_sparRound-off: with gfortran every output of the 52 example decks is byte-identical, with one thread and with the default thread count. With the release build, three output files differ by at most 8.6e-7 of their column maximum. The line-break deck amplifies that difference after the break by as much as gfortran and IFX builds of the unchanged code differ from each other.
Junction tangent fix
The monolithic body and point coupling query each tension-only line step for its condensed end tangent, back-solving with the step's last factorization; a warm re-solve starts from that factor. A fresh tangent evaluation overwrote
eff_bandbefore it was factored but left the "factored" flags set, so a step that ended right there (accepted within the near-tolerance allowance at its iteration limit, or converged on the fresh tangent) back-solved with an unfactored matrix.Tests
test_hydro,test_damping).mb_hits, a saturating test-only counter): repeats hit; changes ofl0,rho_aor the free list miss.test_cable_dynamic).pre-commit run --all-filesand the Sphinx build with-Wpass.Checklist
pre-commit run --all-filespassesctest --test-dir build --output-on-failurepassespython -m pytest tests python/testspasses (if Python or validation records changed)[Unreleased](heading added if missing) for user-visible changesdoc/updated for changed inputs, options, or outputs — no input, option or output changesfeat:,fix:,docs:, ...)git commit -s) under theDeveloper Certificate of Origin