Repository navigation
perf: evaluate each directional-sea phase and depth profile once - #9
Merged
Merged
Conversation
Profiling the release build showed the directional-sea kinematics (CD_Sea_Kinematics, the deck's wavetrain rows and spectral seas) taking 80 % of a chain run in a two-train sea. For every node, step and component it computed the phase cosine twice (for the elevation and again for the kinematics) and two exponentials for the depth profile. The cosines of the elevation pass are now kept for the kinematics pass (up to 4096 components; any further ones are recomputed), and the depth profile uses EXP(-k (z + 2h)) = e2kd / EXP(k z) with the table's e2kd = EXP(-2 k h), as the JONSWAP component path does. A component whose EXP(k z) or e2kd underflows, or a call at another depth than the synthesis, takes the second exponential instead; the sea now records the depth of its synthesis for that test. With the release build the two-train chain example runs in 1.57 s instead of 1.89 s (-17 %). The formulas are unchanged. With gfortran the outputs of the two directional-sea examples are bit-identical; with IFX the reuse removes a fused sin/cos evaluation of the second pass, and one channel of chain_torsethaugen_spread.dat differs by one unit in its eighth printed digit at isolated rows. A new unit test checks the kinematics against a direct per-component sum, with all cosines kept, with cosines past the kept length, with underflowing exponentials, and at another depth. 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. Nice work! 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". |
5 of 8 tasks
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
Speeds up the directional and multi-train sea kinematics (
CD_Sea_Kinematics:wavetrainrows, spectralwavesrows,WaveSpreading).On the release-equivalent build, these kinematics take 80 % of
examples/chain_two_train_sea.dat. For every node, step and component, the routine computed:Changes:
EXP(-k (z + 2h)) = e2kd / EXP(k z)with the table'se2kd = EXP(-2 k h), as the JONSWAP component pathCD_Component_Wave_Kinematicsalready does.EXP(k z)ore2kdunderflows;CD_SeaTypenow records its synthesis depth for this test.Speed (IFX 2025.3.2 release-mirror build, one thread, median of 3, isolated runs):
chain_two_train_seaResults. The formulas are unchanged; the evaluation is reorganised.
chain_two_train_seachain_torsethaugen_spreadAnchTen1only, isolated rows from row 1813Tests
New
case_kinematics_referenceintests/test_wave_spectra.f90. It comparesCD_Sea_Kinematics(elevation, velocity, acceleration, dynamic pressure) against a direct per-component sum of the original formulas, to 1e-11 relative. It covers four seas:The sampled points are below the surface, near the seabed, and one above the surface.
Full suite, Windows, gfortran 16.2, Release, slow tier included: 245/245 pass.
pre-commit run --all-filespasses.Checklist
pre-commit run --all-filespassesctest --test-dir build --output-on-failurepassespython -m pytest tests python/testspasses (if Python or validation records changed) — not applicable[Unreleased](heading added if missing) for user-visible changesdoc/updated for changed inputs, options, or outputs — not applicable, no inputs or outputs changedfeat:,fix:,docs:, ...)git commit -s) under theDeveloper Certificate of Origin