Add memory-aware two-level MC chunk planner (rev2) and grouped-save parfor wrapper (rev9)#5
Open
nicklasorte wants to merge 1 commit intomainfrom
Conversation
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.
Motivation
parforby ensuring unique output files per grouped save chunk.Description
dynamic_mc_chunks_rev2.mimplementing a two-level planner that computes a memory-safecompute_chunk_sizefromworker_memory_mb,target_memory_utilization,num_bs, andnum_sim_aziusing a conservative safety multiplier (4x), then groups compute subchunks intonum_save_chunkscapped bymax_saved_chunks(preferred cap 128).parfor_randchunk_aggcheck_rev9_claude.mwhich processes one save chunk at a time, iterates its memory-safe compute subchunks viasubchunk_agg_check_rev8, accumulates results in memory, and writes a single grouped.matfile per save chunk using a temp-file-then-movefilepattern and retry logic to reduce partial-write/corruption risk.validate_grouped_chunk_strategy_rev1.mwhich provides automated integrity checks and an optional numerical A/B path that reconstructs baseline (per-compute) vs grouped-save outputs and verifies size equality, NaN pattern equality, max absolute difference, randomized-order invariance, and restart-skip behavior..mfiles unchanged, returns a structuredchunk_plan(mappings, ranges, randomized save order, and derived sizing info), and enforces parfor-safety by ensuring no concurrent writes to the same file.Testing
dynamic_mc_chunks_rev2.m,parfor_randchunk_aggcheck_rev9_claude.m, andvalidate_grouped_chunk_strategy_rev1.mto verify the expected interfaces and required fields are present.octave --versionbut the Octave/MATLAB runtime was not available in this environment, so no numerical tests were executed here.validate_grouped_chunk_strategy_rev1implements the automated numerical checks (baseline vs grouped assembly, randomized-order invariance, and restart-skip detection) and can be run in a MATLAB/Octave environment against representative inputs to confirm numerical equivalence and restart behavior.Codex Task