Add rev10: regression-safe max-azimuth refactor and validation harness#6
Add rev10: regression-safe max-azimuth refactor and validation harness#6nicklasorte wants to merge 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9bee82b46
ℹ️ 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".
| for loop_idx=1:1:num_mc_idx | ||
| base_mc=sort_monte_carlo_pr_dBm_all(:,loop_idx); | ||
| sort_temp_mc_dBm=base_mc+off_axis_gain_matrix; | ||
|
|
There was a problem hiding this comment.
Reinstate bounded azimuth batching in MC aggregation
This revision computes base_mc + off_axis_gain_matrix for the full azimuth set on every Monte Carlo iteration, which raises peak temporary memory from O(num_bs*azi_chunk) in rev9 to O(num_bs*num_sim_azi). For larger production shapes (many BS rows and fine beamwidths), this can trigger out-of-memory failures on workers even though rev9’s chunked loop completed, so the refactor is not regression-safe under high-load inputs.
Useful? React with 👍 / 👎.
| abs_diff = abs(out_rev9_a - out_rev10_a); | ||
| rel_diff = abs_diff ./ denom; | ||
| max_abs_diff = max(abs_diff,[],'all'); | ||
| max_rel_diff = max(rel_diff,[],'all'); |
There was a problem hiding this comment.
Mask non-finite entries before computing max diffs
The harness computes abs(out_rev9_a - out_rev10_a) and then takes max(...) over all elements; when both outputs contain matching Inf or NaN entries, operations like Inf-Inf produce NaN, causing max_abs_diff/max_rel_diff to become NaN and the final tolerance check to fail even though nan_pattern_match/inf_pattern_match are true. This yields false FAIL results for valid equivalence cases with non-finite outputs.
Useful? React with 👍 / 👎.
Motivation
maxscans while preserving function contract, units, and numerical behavior.Description
subchunk_agg_check_maxazi_rev10.m, a refactor of rev9 that preserves the MC seeding pattern (rng(rand_seed1+mc_iter),+1,+2) and keeps the MC loop to maintain RNG stream semantics while removing the azimuth chunk loop and repeated partialmaxscans; aggregation now computesdBm -> watts -> sum -> dBmacross the full azimuth set and takes a singlemaxper MC iteration.DEBUG_CHECKS=falseto avoid hot-path cost.maxoperations while keeping numeric operations and shapes identical to rev9.validate_subchunk_agg_check_maxazi_rev10.m, a deterministic regression harness that builds fixed synthetic cases (small,medium,large), runs bothsubchunk_agg_check_maxazi_rev9andsubchunk_agg_check_maxazi_rev10on identical inputs, checks shape/NaN/Inf patterns, reproducibility, computesmax_abs_diffandmax_rel_diff, enforces a tight tolerance (tol = 1e-10), measures runtime (usingtimeitwhere available ortic/toc), and fails fast on any mismatch.Testing
subchunk_agg_check_maxazi_rev10.mandvalidate_subchunk_agg_check_maxazi_rev10.m) using file-printing/smoke commands (nl -ba), which succeeded in this environment.size, column-shape[num_mc_idx x 1],NaN/Infpattern equality, reproducibility, computesmax_abs_diffandmax_rel_diff(denominatormax(abs(out_rev9),1e-12)), usestol = 1e-10, measures runtime withtimeitfallback totic/toc, prints a structured summary, and raises an error on failure.Codex Task