Skip to content

perf: faster tension-only line steps; refactor the junction tangent after an unfactored exit - #19

Merged
SMI-Lab-Inha merged 4 commits into
devfrom
perf/ei0-overhead
Oct 16, 2026
Merged

SMI-Lab-Inha merged 4 commits into
devfrom
perf/ei0-overhead

Conversation

@SMI-Lab-Inha

Copy link
Copy Markdown
Owner

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:

  • the line-load element kernels re-validated section data that 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;
  • zero velocity Jacobians of the Froude-Krylov and buoyancy loads were added into the band;
  • the consistent-mass band was re-assembled although it depends only on connectivity, free DOFs, lengths and masses per length;
  • the Newton solve rescanned a band and factor just checked finite, and workspace helpers blanked messages on every call.

Changes:

  • The kernels take an optional 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.
  • The two hydro kernels share private helpers that form the unit tangent once.
  • The mass band is reused while its inputs are unchanged (compared exactly); every other writer of the band clears the reuse.
Deck (release, gfortran) Speed-up
chain_range_tdp 16 %
als_volturnus_line_break_time 13 %
spar_pinned_rods 13 %
rod_moored_spar 12 %

Round-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_band before 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.

  • In a unit test reaching the allowance exit, the end tangent was off by 2.3e5 (relative) and the end map by 1.5e6; with the flags cleared at the evaluation they agree with an ordinary exit to 1.8e-11 and 1.2e-10.
  • Cost: an extra assembly and factorization of a junction step that exits on a fresh tangent. No example deck takes this path; all 52 are byte-identical.

Tests

  • Trusted kernels against the validating ones, bit for bit (test_hydro, test_damping).
  • The reused mass band equals a fresh assembly, and each step states whether it must hit the reuse (mb_hits, a saturating test-only counter): repeats hit; changes of l0, rho_a or the free list miss.
  • The junction tangent after an allowance exit (test_cable_dynamic).
  • Full suite, Windows, gfortran, Release, slow tier included: 261/261. Python: 1969 passed. pre-commit run --all-files and the Sphinx build with -W pass.

Checklist

  • pre-commit run --all-files passes
  • ctest --test-dir build --output-on-failure passes
  • python -m pytest tests python/tests passes (if Python or validation records changed)
  • VALIDATION.md updated if a validation result changed — no validation result changes
  • CHANGELOG.md updated under [Unreleased] (heading added if missing) for user-visible changes
  • Documentation in doc/ updated for changed inputs, options, or outputs — no input, option or output changes
  • Conventional Commit title (feat:, fix:, docs:, ...)
  • Commits are signed off (git commit -s) under the
    Developer Certificate of Origin

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>
@SMI-Lab-Inha

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T10:01:07.695673Z c5d400b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 CableDyn | 🛠️ Build #35189227 | 📁 Comparing c5d400b against latest (f27c5e3)

  🔍 Preview build  

21 files changed · ± 21 modified

± Modified

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: c5d400be21

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@SMI-Lab-Inha
SMI-Lab-Inha merged commit 4dfbc7a into dev Oct 16, 2026
15 checks passed
@SMI-Lab-Inha
SMI-Lab-Inha deleted the perf/ei0-overhead branch October 17, 2026 09:04
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