- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Select C optimization level
Select C optimization level
Select C optimization level
I would like to compare compiling and execution speeds of some of my models using the O0, O1, O2, O3 flags.
How can I select these flags from OMEdit?
I looked at the documentation but could not find the answer.
Thanks
- ceraolo
- 147 Posts
Re: Select C optimization level
https://openmodelica.org/doc/OpenModeli … eneral-tab
C/C++ Compiler Flags (Optional) – the optional C/C++ compiler flags
Adeel.
- adeas
- 454 Posts
Re: Select C optimization level
it worked, thank you.
I've seen that for me it is best to use nearly always -O0. Is there a way to make this the default choice?
Thanks again.
- ceraolo
- 147 Posts
Re: Select C optimization level
Unfortunately, there is no way to make this a default choice.
Adeel.
- adeas
- 454 Posts
Re: Select C optimization level
Ah, thank you.
This is rather limiting for teaching.
For teaching we change models continuously, and therefore savings in time during compilation make classrooms much better.
According to a few simple tests, with O0 I have 20% time savings as an average, which is very significant in a classroom of students.
It seems that today to have O0 you must:
- set the C/C++ compiler flag for a model and, simultaneously simulate (if you set it for a given model thinking to simulate later you lose it)
- for any new model you must add that flag manually
- this flag is not saved into models, so are not retained between sessions.
It is too complicated to be used with students.
Do you think there is a simple way to add somewhere the possibility to set optimisation level for all models, all simulations?
Maybe I'm not the only one having this need, and therefore I plan to set a ticket on this. Beforehand, I will make some other speed tests.
- ceraolo
- 147 Posts
Re: Select C optimization level
Yes please make a ticket about it. I believe saving this inside a model doesn't make sense but we could have a global optimization option that all models use during the compilation.
Adeel.
- adeas
- 454 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Select C optimization level