cadCAD-org / cadCAD

Design, simulate, validate, and operate within complex systems
https://cadcad.org
MIT License
549 stars 271 forks source link

cadCAD parallelized simulations run in series #242

Closed BenSchZA closed 3 years ago

BenSchZA commented 3 years ago

As part of the following hot-fix https://github.com/cadCAD-org/cadCAD/issues/186 , parallelization of simulations was disabled through the commenting out of the following lines https://github.com/cadCAD-org/cadCAD/blob/86062edd792a4ecf1e7c981e29c1df44268be90a/cadCAD/engine/execution.py#L102 .

The following simulation, for example, is run in series:

Execution Mode: local_proc
Configuration Count: 1
Dimensions of the first simulation: (Timesteps, Params, Runs, Vars) = (329, 55, 3, 49)
Execution Method: local_simulations
SimIDs   : [0, 0, 0]
SubsetIDs: [0, 1, 2]
Ns       : [0, 1, 2]
ExpIDs   : [0, 0, 0]
Execution Mode: parallelized

By un-commenting the lines in execution.py, the runs are parallelized again, but it's unclear what effect that has on the hot-fixed issue.

randomshinichi commented 3 years ago

I can confirm this using exec_mode.local_mode.

1 runs, 300 timesteps: 75s 5 runs, 300 timesteps: 138s

Although 5 runs doesn't take 5x longer, htop shows only one CPU being used, and 5 runs should be spread out over my 6 CPUs, so it should actually take the same amount of time to run 5 runs as 1. So there must be some kind of optimization happening here.

JEJodesty commented 3 years ago

@BenSchZA Re included process pool. Sorry for the wait access via Build From Source in the staging branch https://github.com/cadCAD-org/cadCAD/tree/staging

274

JEJodesty commented 3 years ago

@randomshinichi The previous release was returning partial results therefore a benchmark at this time is unwarranted Will merge A/B tested for future release Related Issue: #248 https://github.com/cadCAD-org/cadCAD/blob/c0491800b12d3b9608b7bfbc9863680c03eae2d1/testing/tests/multi_model_row_count.py#L96

Will add runtime performance benchmark between upcoming and current releases as Acceptance Criteria of future releases after the next release