Multi-thread usage in Dymola slow down solution speed

Viewed 143

Does using multi-core functionality in Dymola2020x always speed up the solution? My observation is using Advanced.ParallelizeCode=true for a model with DOF~23k; compiling time is comparable with single thread however the solution time with default solver is slower.

Any comments are appreciated!

1 Answers

Multi-core functionality of a single model does not always speed up execution.

There are a number of possible explanations:

  • There are so many dependencies that it isn't possible to parallelize at all. (Look at translation log - this is fairly clear).
  • It's only possible to parallelize a small part of the model. (Look at translation log - this takes more time).
  • The model uses many external function (or FMUs), and by default Dymola treat them as critical sections. (See release notes and manual on __Dymola_ThreadSafe and __Dymola_CriticalRegion).
  • In versions before Dymola 2020x you might have to set the environment variable OMP_WAIT_POLICY=PASSIVE. (Shouldn't be needed in your version.)

Using decouple as described in https://www.claytex.com/tech-blog/decouple-blocks-and-model-parallelisation/ can help for the first two.

Note that an alternatives to parallelization within the model is to parallelize a sweep of parameters (if that is your scenario). That is done automatically for sweep parameters, and without any of these drawbacks.

Related