Jack
Jack

Reputation: 1232

Parallel simulation setting in Dymola

I am building a large system in Dymola, I plan to exploit the parallel simulation potential in Dymola, but I just find two general settings in the help document.

My questions are:

  1. Is there any other setting I could use in Dymola so the code would run faster?
  2. In my model code, is there any method that allows the model to run in a parallel mode? For example, I know MATLAB code style is using vectors, so does that mean in Modelica I should use vectors too?

enter image description here

enter image description here

Upvotes: 1

Views: 767

Answers (1)

Hans Olsson
Hans Olsson

Reputation: 12507

The Advanced.ParallelizeCode-flag does generate code that runs in parallel (hopefully, check the log), and vectorization as in Matlab does not help here (it may even cause problems).

What you can do instead is:

  • As described in User manual 1B section Handling of external functions in parallel code add annotation(__Dymola_ThreadSafe=true); to called functions, after checking that they are thread-safe.
  • Try to ensure that there is some form of dynamics separating the different parts of the model.
  • If it is not possible to naturally treat the different parts in parallel you might use the decouple operator (look in the dymola\Modelica\Libraries\DecoupleBlocks.mo ); but be careful to verify the results first.

The flag Advaned.ParallelSimulations does not seem relevant for this case, as it runs entire simulations with different parameter values in parallel (much more coarse-grained). If you only run one simulation at a time that gives no benefit.

However, if you could change to use this instead it is in general a better idea - and you should then (in general) not enable the other parallelization variant.

Upvotes: 5

Related Questions