Repository navigation
13 Run several simulations at once (tools/run_many.py) - #29
Merged
Merged
Conversation
adamf
force-pushed
the
pr13-run-many
branch
from
September 26, 2026 20:31
9679446 to
64a9ff0
Compare
**Builds on PR 8 (seanth#24)**; it uses the `-rngstart` option from PR 3. It doesn't touch any of Vida's code, and doesn't depend on PRs 10–12. [This PR's changes on their own](pr8-web-viewer...pr13-run-many). ## Run several simulations at once (`tools/run_many.py`) Within one simulation everything happens in a set order, drawing on the same stream of random numbers, so one simulation can't be split across cores without changing its results. But separate simulations don't share anything. This tool runs each one as its own copy of Vida, side by side, so a computer with 4 or 8 cores gets through 4 or 8 times as many runs. ```sh # the same simulation with -rngstart 1 to 8, four at a time python tools/run_many.py -rngstarts 1-8 -jobs 4 -- -n forest -w 100 -s 400 -t 50 # a list of different simulations, one line of options each python tools/run_many.py -file runs.txt ``` - **Names:** with `-rngstarts`, each run is named after the `-n` name and its `-rngstart` (`forest-rng1`, `forest-rng2`, ...). Its output goes where Vida puts it (`Output-forest-rng1/`), and what it prints goes to `Output-forest-rng1.log` next to it. - **How many at once:** `-jobs` defaults to the number of cores. - **Summary:** at the end it says how long everything took, and which runs failed, if any. ### Checked - **Speed:** on a 4-core machine, four 100 m, 400-seed, 50-cycle runs took 41.0 s one after another and 11.7 s side by side. - **Same results:** each of those runs' `viewer.jsonl` (every plant, every cycle) is identical to a run with the same `-rngstart` on its own, apart from the run's name. - **Unit tests** cover reading the `-rngstarts` list and the file, and naming the runs. ### Also The HOWTO gets an example 9, next to example 8's `-x`, which still runs its repeats one after another. The `-x` repeats share one stream of random numbers: the second repeat starts where the first one left off. So they can't simply run side by side with the same results. `run_many` gives each run its own `-rngstart` instead. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_013425y5x98TqAv3BvHodpdx
adamf
force-pushed
the
pr13-run-many
branch
from
September 27, 2026 17:12
64a9ff0 to
b6a64ba
Compare
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.
Builds on PR 9 (#25), for the
-seedoption from PR 3. It doesn't touch any of Vida's code, and doesn't depend on PRs 10–12. This PR's changes on their own.Run several simulations at once (
tools/run_many.py)Within one simulation everything happens in a set order, drawing on the same stream of random numbers, so one simulation can't be split across cores without changing its results. But separate simulations don't share anything. This tool runs each one as its own copy of Vida, side by side, so a computer with 4 or 8 cores gets through 4 or 8 times as many runs.
-seeds, each run is named after the-nname and its seed (forest-seed1,forest-seed2, ...). Its output goes where Vida puts it (Output-forest-seed1/), and what it prints goes toOutput-forest-seed1.lognext to it.-jobsdefaults to the number of cores.Checked
viewer.jsonl(every plant, every cycle) is identical to the same seed run on its own, apart from the run's name.Also
The HOWTO gets a short section next to
-x, which still runs its repeats one after another. The-xrepeats share one stream of random numbers: the second repeat starts where the first one left off. So they can't simply run side by side with the same results.run_manygives each run its own seed instead.🤖 Generated with Claude Code
https://claude.ai/code/session_013425y5x98TqAv3BvHodpdx