Repository navigation
Make virtual-guide trace comparisons robust to round-off in silent components - #956
Merged
Merged
Conversation
…mponents test_rotated_virtual_fields[True-double-+-1-2-TE] failed twice on hosted CI (PRs #953 and #955, neither of which touches the solver) with a "relative error" of 2e-3 while the actual difference between the reference and virtual runs was ~5e-13 on a field of amplitude 216. The comparison scaled each trace component by its own peak with a floor of 1e-12 of the global peak, so the three identically-zero out-of-plane components of a reduced 2D run were compared against an absolute tolerance of ~4e-18, far below double round-off. Any residual there, however small, failed the test. The divergence itself only appears on the hosted runners and could not be reproduced locally with MKL or OpenBLAS numpy, any thread count, repeated in-process runs or CPU contention. Add normalized_trace_error() to the 2D validation module: components that carry signal are still scaled by their own peak, while components whose reference peak is below 1e-6 of the global peak are measured against the global peak. Use it in the three tests that shared the old floor, and hold the inactive grid components of the reduced run to the same round-off bound instead of exact zero. Co-Authored-By: Claude Fable 5.1 <[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.
Summary
tests/impedance_surfaces/test_2d_sibc.py::test_rotated_virtual_fields[True-double-+-1-2-TE]failed on hosted CI for #953 (7 Nov) and #955 (9 Nov), neither of which touches the solver, while master passed the same suite at the same commit on 5 Nov.The reported "relative error" was 2e-3, but the underlying difference between the reference and virtual-guide runs was ~5e-13 on a field of amplitude 216. The comparison scaled each receiver component by its own peak with a floor of 1e-12 of the global peak, so the three identically zero out-of-plane components of a reduced 2D run were effectively compared against an absolute tolerance of ~4e-18, below double round-off. Any residual there, however small, failed the test.
The round-off divergence itself only shows up on the hosted runners: with MKL numpy, with the same OpenBLAS numpy as the CI wheel, at 1 to 8 OpenMP threads, 1 to 4 BLAS threads, across the whole file in one pytest process, and twelve back-to-back repetitions under a 36-process CPU load, the two runs are bit-identical here, including every port and mode-solver array.
Changes
normalized_trace_error()totesting/validation/impedance_surface/validate_2d.py. Components carrying signal are still scaled by their own peak, so the weak magnetic traces are held to the same relative accuracy as the strong electric ones. Components whose reference peak is below 1e-6 of the global peak are measured against the global peak instead.test_virtual_continuation,test_rotated_virtual_fieldsandtest_extruded_impedance_virtual_guide_matches_monolithic, which shared the old floor.tolerance * peak) instead of exact zero.No solver code is changed. The report script
compare_guides()keeps its own metric.Verification
Synthetic check of the helper: a CI-sized residual (5e-13 in a silent component plus 1e-13 noise on Ex) scores 2.3e-15; a 1e-7 relative error on Hy scores 1e-7; a 1e-5 absolute leak into a silent component scores 4.6e-8; all against the 2e-8 threshold.
Both changed test files pass locally with the OpenBLAS build matching CI: 201 passed, 120 deselected by the standard markers.
🤖 Generated with Claude Code