SeedReport: Saving & Replaying RNG seed capability. - #378
SeedReport: Saving & Replaying RNG seed capability.#378drewconnelly-qntm wants to merge 11 commits into
SeedReport: Saving & Replaying RNG seed capability.#378Conversation
Testing the following: - tests seedreport data saving correctly - tests determinism when seeds are the same, and disagreement when seeds are not - tests agreement between a job and the re-running of that job - tests loading a seed report from json and string, as well as failure when no file exists to import from.
|
I haven't looked closely but just skimming things: You might want to see if you can do this without using an Arc Mutex. They are slightly expensive. |
Thanks, I'll check on how necessary that is. |
It was annoying the lint checker.
ReviewNice feature and the right general shape: the report is the single source of truth for worker seeds, the JSON round-trip is tested, and error paths map to 1. The replay tests are vacuous (blocking)The two headline tests — Shot-level determinism is untested anywhere: Fix: use a fixture whose output actually depends on the RNG (e.g. 2. ~110 lines duplicated verbatim (blocking)
fn run_workers_with_seeds(
&self,
worker_seeds: &[u64],
shots_per_worker: &[usize],
) -> Result<ShotVec, PecosError>and having both paths call it. 3. Replay half-ignores the loaded reportA
4.
|
Changes:
In
crates/pecos-engines/src/monte_carlo/engine.rs:SeedReportwhich stores the RNG seed information for a monte carlo runrun_with_workers_seed_reportwhich runs a monte carlo job with workers, while managing the RNG seeds with a seed report. Has a bool option to save the report to a JSON namesseed_report.json.WorkerSeedRecordwhich stores the worker index, num shots, and seed for that worker, which is what is held in a vector inside the overall job'sSeedReportfor each monte carlo job.SeedReportto JSON as well as loading them from JSON.Potential Future Work:
Testing:
cargo test -p pecos-engineswas all goodjust build; just testran through the rust tests fine but had issues with the python pytests due to some bugs with my environment locally.