Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Speed of Translate/compile

Speed of Translate/compile

This is more of a general question. I'm trying to understand what kinds of things in models make translation/compilation phase take a long time. I have models, for instance, that take 1.5 minutes to compile, when the solve only takes 30 seconds or less. Are there known issues of specific types of models that take longer to translate and compile? Unfortunately I can't share the specific models, which is why I ask the question this way.

Re: Speed of Translate/compile

I would say these things make compilation slower (in no particular order):
- unqualified paths (we need to search to the top to find the match), try to use fully qualified paths if possible
- components that have mutual modifications: Type1 a(b.x); Type2 b(a.y);
- redeclares: for this we need to generate unique types for all types that have redeclare in them for each different component prefixes down to the leafs
- global effects such as expandable connectors and inner outer
- package constants (we need to be able to evaluate them), especially those that have function calls as bindings which cannot be interpreted (dll generation)
- cardinality operator
- overconstrained connectors (we need to evaluate all branch, root, potentialRoot, connect and do a lot of analysis on connection sets)

I think by far the slowest part happens if we need during compilation to compile functions  as dlls and execute them to get the binding of a constant in a package.
You can try to compile your models with +d=nogen to disable dll generation during compilation to see if your models work that way.

Try to run the models with +d=execstat to see where the compiler spends the most time and let us know.

What version of OpenModelica are you using? The latest nightly or the 1.9.6 release?

Re: Speed of Translate/compile

I don't understand how to run with the +d=execstat in OMEdit. How do I set that debug flag or the +d=nogen?

Re: Speed of Translate/compile

Tools->Options->Simulation->OMC Flags: +d=initialization,nogen,execstat
And then restart OMEdit.

Edited by: adrpo - Jun-29-16 01:21:03

Re: Speed of Translate/compile

I was able to run the diagnostics, and it looks like the part that takes the longest is the performance of FrontEnd:
Performance of FrontEnd: time 4.295/4.735, allocations: 0.6534 GB / -175796800, free: 28.79 MB / 474.9 MB

This is almost half of the compilation time for this particular model. It varies by model, but for the ones I have looked at, this is always a large fraction of the compile time. Does this tell you anything about the potential causes?

Thanks!

Re: Speed of Translate/compile

Very late reaction, but if you're as new to openmodelica as I am, look for "An Analysis of Performance-critical Properties of Modelica Models", which introduction nicely explains what's happening during frontend/backend/compiling.

If you cannot find said article, you can try looking for:
Cellier, F.E. and Kofman, E. (2006). Continuous system simulation. Springer.
Fritzson, P. (2010). Principles of object-oriented modeling and simulation with Modelica 2.1. John Wiley & Sons.

Which are also named in the article as good references

Re: Speed of Translate/compile

I just read this paper, it mentioned that he used a cluster including eight nodes, How could I configure my 2 PC to run in parallel.
https://s1.ax1x.com/2018/01/26/pqBaxP.png

Re: Speed of Translate/compile

I think they mean they used mulitple computers that do multiple simulations. Not that multiple computers are working together on the same simulation. But the paper is really old compared to the lifetime of openmodelica. Maybe it's possible.

There are 0 guests and 0 other users also viewing this topic