Skip to content

SeedReport: Saving & Replaying RNG seed capability. - #378

Open
drewconnelly-qntm wants to merge 8 commits into
devfrom
saving_rng_seeds
Open

SeedReport: Saving & Replaying RNG seed capability.#378
drewconnelly-qntm wants to merge 8 commits into
devfrom
saving_rng_seeds

Conversation

@drewconnelly-qntm

@drewconnelly-qntm drewconnelly-qntm commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Changes:

In crates/pecos-engines/src/monte_carlo/engine.rs:

  • Introduces SeedReport which stores the RNG seed information for a monte carlo run
  • Introduces run_with_workers_seed_report which 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 names seed_report.json.
  • Introduces WorkerSeedRecord which stores the worker index, num shots, and seed for that worker, which is what is held in a vector inside the overall job's SeedReport for each monte carlo job.
  • Introduces methods for saving a SeedReport to JSON as well as loading them from JSON.

Potential Future Work:

  • Lets work start up on Error Pruning, Visualizing now that we can save monte carlo runs and rerun them.
  • Opens the possibility for single-shot replaying, so the user can identify a particular shot (or maybe all shots with logical failures) and rerun that exact shot. Right now only rerunning the entire monte carlo job is permitted.

Testing:

cargo test -p pecos-engines was all good
just build; just test ran through the rust tests fine but had issues with the python pytests due to some bugs with my environment locally.

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.
@drewconnelly-qntm drewconnelly-qntm self-assigned this Jul 27, 2026
@drewconnelly-qntm drewconnelly-qntm added the enhancement New feature or request label Jul 27, 2026
@qciaran

qciaran commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

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.

@drewconnelly-qntm

Copy link
Copy Markdown
Collaborator Author

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.

@drewconnelly-qntm
drewconnelly-qntm marked this pull request as ready for review July 28, 2026 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants