Add rev11: pre-generate MC RNG, preserve azimuth chunking, and add validator/benchmark#8
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36a8e200b0
ℹ️ 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".
| rng(rand_seed1); | ||
| rel_span=(rel_max-rel_min); | ||
| rand_pr_all=rel_min+rel_span.*rand(num_bs,num_mc_idx); | ||
| rand_eirp_all=rel_min+rel_span.*rand(num_bs,num_mc_idx); | ||
| rand_clutter_all=rel_min+rel_span.*rand(num_bs,num_mc_idx); |
There was a problem hiding this comment.
Derive RNG stream from MC indices when pre-generating draws
This reseeds the generator with only rand_seed1 on every function call, so different sub_point_idx chunks regenerate the same random matrices whenever num_mc_idx is the same. In the chunked workflow (cell_sim_chunk_idx), that duplicates Monte Carlo realizations across chunks instead of producing unique draws per mc_iter, which can materially skew aggregate percentiles and reduce effective sample size. The pre-generation should incorporate sub_mc_idx/mc_iter identity (as prior revs did) or otherwise skip ahead in a deterministic way per chunk.
Useful? React with 👍 / 👎.
Motivation
rng(...)reseeding and eliminating repeated random draws inside the MC loop while preserving the aggregate max-azimuth output contract.AZI_CHUNKfor different environments.Description
subchunk_agg_check_maxazi_rev11.mwhich seeds once withrng(rand_seed1)and pre-generatesrand_pr_all,rand_eirp_all, andrand_clutter_allwith dimensions[num_bs x num_mc_idx]and bounds[rel_min, rel_max]for use across MC iterations.AZI_CHUNK_DEFAULT=128and optional override viavarargin, and added a short comment explaining the memory/performance tradeoff.db2pow, sum across BS, power→dB viapow2db, then max over azimuth) and maintained nearest-point off-axis gain behavior.DEBUG_CHECKS=falseand tracking per-chunk maximums to avoid repeated full-vector max scans.validate_subchunk_agg_check_maxazi_rev10_rev11_statistical.mto run rev10 vs rev11 on identical inputs, report runtimes/speedup, compute distribution and upper-tail statistics, apply documented drift thresholds, and return aresultsstruct with a PASS/FAIL flag.benchmark_subchunk_agg_check_maxazi_rev11_chunk_sweep.mto sweep chunk sizes (default[64 128 256 512]) across trials, print a summary table, and recommend the fastest observedAZI_CHUNK.Testing
subchunk_agg_check_maxazi_rev11.m,validate_subchunk_agg_check_maxazi_rev10_rev11_statistical.m,benchmark_subchunk_agg_check_maxazi_rev11_chunk_sweep.m) and the commit succeeded.Codex Task