Skip to content

Support for running scenarios in parallel - #3767

Merged
quaquel merged 58 commits into
mesa:mainfrom
quaquel:parallel_scenarios
Jul 5, 2026
Merged

quaquel merged 58 commits into
mesa:mainfrom
quaquel:parallel_scenarios

Conversation

@quaquel

@quaquel quaquel commented Jul 1, 2026

Copy link
Copy Markdown
Member

This PR builds on #3756 by adding support for running scenarios with a parallel executors such as ProcessPoolExecutor and MPIPoolExecutor.

The main things it adds are

  • Fills in the the branch if executor is not None
  • Handles failures where the entire pool crashes, turning all scenarios that have not finished into a new state: ABORTED
  • Various other minor changes as knock on effects from these two points.

I have tested this already successfully with a process pool, I will test this with MPI asap.

quaquel and others added 30 commits June 18, 2026 14:30
@quaquel
quaquel force-pushed the parallel_scenarios branch from df4c7e4 to 5bd96bf Compare July 1, 2026 08:40
@quaquel
quaquel marked this pull request as ready for review July 3, 2026 07:41
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +0.9% [+0.0%, +1.8%] 🔵 -2.0% [-2.3%, -1.8%]
BoltzmannWealth large 🔵 -0.4% [-1.5%, +0.6%] 🔵 -2.1% [-3.9%, -0.6%]
Schelling small 🔵 -0.4% [-1.1%, +0.3%] 🔵 -3.6% [-4.3%, -2.9%]
Schelling large 🔵 +0.7% [+0.1%, +1.4%] 🔵 -3.6% [-5.3%, -1.6%]
WolfSheep small 🔵 -0.8% [-1.7%, +0.1%] 🔵 -3.6% [-7.5%, +0.6%]
WolfSheep large 🔵 -0.1% [-0.9%, +0.8%] 🔵 -1.4% [-2.9%, -0.0%]
SugarscapeG1mt small 🔵 +3.5% [+2.8%, +4.2%] 🔵 -1.5% [-3.7%, +0.6%]
SugarscapeG1mt large 🔵 +1.4% [-0.4%, +3.1%] 🔵 -1.2% [-2.3%, -0.0%]
BoidFlockers small 🔵 +0.1% [-0.5%, +0.5%] 🔵 -0.6% [-0.9%, -0.2%]
BoidFlockers large 🔵 +0.1% [-0.3%, +0.5%] 🔵 -0.4% [-0.6%, -0.1%]

),
)
_record(scenario, result)
except BrokenExecutor as e:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am pretty rusty on parallel executions, but don't you need to cancel all your futures here, as other runs may be still be failing on other processors

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A broken executor will result in the crash of the entire pool, so no need to cancel the futures. What we have to do, however, is mark all the outstanding scenarios as being aborted, which is exactly what this code does.

@tpike3 tpike3 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@quaquel
quaquel merged commit 379088c into mesa:main Jul 5, 2026
10 of 11 checks passed
@quaquel
quaquel deleted the parallel_scenarios branch July 6, 2026 05:38
@EwoutH EwoutH mentioned this pull request Nov 15, 2026
53 of 65 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Release notes label experimental Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants