Parallelize examples with joblib (closes #5)#65
Conversation
Bumps [https://github.com/astral-sh/ruff-pre-commit](https://github.com/astral-sh/ruff-pre-commit) from v0.15.14 to 0.15.15. - [Release notes](https://github.com/astral-sh/ruff-pre-commit/releases) - [Commits](astral-sh/ruff-pre-commit@v0.15.14...v0.15.15) --- updated-dependencies: - dependency-name: https://github.com/astral-sh/ruff-pre-commit dependency-version: 0.15.15 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
PR Summary
This update delivers an improved, efficient, and parallel execution process that promises increased productivity and faster task execution. It streamlines the simulation process, allowing us to handle more tasks concurrently. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #65 +/- ##
=======================================
Coverage 96.37% 96.37%
=======================================
Files 17 17
Lines 496 496
=======================================
Hits 478 478
Misses 18 18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Bumps [https://github.com/astral-sh/ruff-pre-commit](https://github.com/astral-sh/ruff-pre-commit) from v0.15.15 to 0.15.16. - [Release notes](https://github.com/astral-sh/ruff-pre-commit/releases) - [Commits](astral-sh/ruff-pre-commit@v0.15.15...v0.15.16) --- updated-dependencies: - dependency-name: https://github.com/astral-sh/ruff-pre-commit dependency-version: 0.15.16 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: endolith <endolith@gmail.com>
Add a short section explaining batching, n_jobs=-3, result aggregation, and that Monte Carlo scripts intentionally omit fixed seeds. Remove parallelization_summary.md (development artifact). Co-authored-by: endolith <endolith@gmail.com>
947aef5 to
b4436ae
Compare
Summary
Closes #5. Adds joblib parallelization to the remaining Monte Carlo example scripts that still ran serial election loops, and documents the shared parallelism pattern in
examples/README.md.Changes
Newly parallelized (10 scripts): Merrill tables/figures and Weber effectiveness/table scripts now use the same
batch_size/Parallel(n_jobs=-3)pattern as the examples that already had joblib.Documentation:
examples/README.mdexplains batching, worker count, result aggregation, and seed behavior (Monte Carlo scripts intentionally omit fixed seeds; parallelism preserves the same statistical intent as a serial loop).Scope:
examples/only — no library or test changes.Reproducibility review
Counter/defaultdicttotals merged on the main process; completion order does not affect aggregates.random_utilities,impartial_culture,normal_electorate,np.random,tiebreaker='random').CI
ruff check examples/ --select=E9,F63,F7,F82— passpytest— passOverlap with PR #52
PR #52 (
elsim.studiesAPI) also refactors the same example files to useJoblibBackendinstead of directjoblib.Parallelcalls. Only one of these PRs should merge as-is — whichever lands second will need a rebase and either adoption ofelsim.studiesor manual conflict resolution. This PR is intentionally scoped toexamples/with direct joblib usage to close #5 without depending on the studies API.