Repository navigation
perf(waves): vectorise the wave component sum - #92
Merged
Merged
Conversation
The wave kinematics of a long elevation record sum thousands of components at every node and step. GNU Fortran kept the block sine, cosine and exponential scalar (their integer conversion and floating MERGE blocked the vectoriser), every build summed in running scalars, and components past the first 1024 had their phase factors evaluated twice. The block kernels now take the quadrant and exponent from the bits of the rounded value, use near-minimax polynomials in Estrin's scheme, and vectorise under GNU Fortran and ifx alike; their errors fall to 2.3 ulp (sine, cosine) and 1.3 ulp (exponential) against quadruple precision. The sums of CD_Component_Wave_Kinematics and CD_Sea_Kinematics run in 64 interleaved lanes added up pairwise, in an order fixed by the source; the depth ratios take one division, a block with an underflowing exponential forms the lower exponential in the block kernel, and the phase factors of up to 4096 components are kept for the velocity sums. Each sum stays a function of its arguments alone: no state, and the same bits at any thread count. On a 298-node finite-EI line in a 4,200 s record of 2,406 components the wave sum falls from 6.0 to 3.0 ms per step with the release flags, and from 18 to 3.6 ms in a GNU AVX2 build. Results change at round-off. The new wave_component_sum test holds the sum to a direct quadruple precision reference across heights, depths and record lengths. Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Signed-off-by: Jae Hoon Seo <jaehoon.seo@inha.ac.kr>
Owner
Author
|
@codex review |
Codex Review Summary: 🔄 RunningThis 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. Keep them coming! 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
Wave kinematics took 70-80 % of a step on a long elevation record: a 4,200 s record cut at 3.6 rad/s keeps about 2,400 components, summed at each node and step. This keeps the exact sum and makes it generate well; spectral seas, wave trains and spread seas share the gain.
Rejected on measurement: splitting the time factor (no gain for moving nodes), recursive phasors (they act on a term that costs almost nothing) and a kinematics grid (an approximation for at most 2x now that the wave share is about 50 %).
Speed
298 nodes, 2,406 components,
dtM0.1, per step:Result changes (round-off)
All 53 decks in
examples/plusmoordynC_wavekin/chain_wavekin7_currents1.datagainst the base:lazy_wave_bend_stiffener: 3e-7 of range.lazy_wave_vessel_rao: 2.1e-3 of range, one decaying spike at 46.8 s; that deck runs at a relative tolerance of 1e-4, and at 1e-11 the difference is 6e-7.als_volturnus_line_break_timeand_tension: 1e-7 of range until about 800 s, then the free post-break drift diverges, as it did with the AVX2 change (up to 0.17 of range onAnchTen2; peaks agree to 4 digits, std to 4e-4).Checks
wave_component_sumcompares against a direct quadruple-precision sum across heights, four depths and 1 to 5,156 components.OPENBLAS_CORETYPE=Prescott; pytest passes; no new compiler warnings.The CHANGELOG entry lands with the release batch.