Opened 5 years ago

Last modified 3 years ago

#5918 assigned defect

Size of Cpp FMU increased by more than 300% with OMSI

Reported by: Rüdiger Franke Owned by: Niklas Worschech
Priority: critical Milestone:
Component: Cpp Run-time Version: v1.16.0-dev
Keywords: Cc: Lennart Ochel

Description

The size of Cpp FMUs increased tremendously with OMSI. For instance the model dll of a simple integrator with one input, one state and one output grew by 7MB. Please remove unnecessary link dependencies!

Take this example:

    setCommandLineOptions("+simCodeTarget=Cpp");
    setCommandLineOptions("-d=newInst");
    translateModelFMU(Modelica.Blocks.Continuous.Integrator, version="2.0");

The size of a win32 FMU grew from 693KB to 2239KB. The size of the extracted binaries/win32/Modelica_Blocks_Continuous_Integrator.dll grew from 2780KB to 9938KB!

Change History (16)

comment:1 by Francesco Casella, 5 years ago

Wow. I would also argue that 2780 kB is quite a lot for an integrator block.

comment:2 by Francesco Casella, 5 years ago

Cc: Lennart Ochel added
Owner: changed from somebody to Niklas Worschech
Status: newassigned

comment:3 by Niklas Worschech, 5 years ago

I will check what the reason is for that

comment:4 by Niklas Worschech, 5 years ago

One problem is, that the write simulation results functionality is linked to the fmu, but this is not needed. I will remove this dependency.
I used the 1.15 maintance branche and the current master branch to compare the sizes. In the 1.15 branch the size of the dll is 5.2MB and in the master branch the size is 9,6 MB

Last edited 5 years ago by Niklas Worschech (previous) (diff)

comment:5 by Rüdiger Franke, 5 years ago

9.6 MB is more or less 9938 KB obtained by me. 5.2 MB is too large. The 1.15 dev version currently available from openmodelica.org:

https://build.openmodelica.org/omc/builds/windows/releases/1.15/maintenance/32bit/OpenModelica-v1.15.0-dev-35-g58a97b19a-32bit.exe

generates a dll with size of 2.7 MB. Possibly another problem introduced into 1.15 dev since the last release of the installer on December 6, 2019?

comment:6 by Niklas Worschech, 5 years ago

Maybe the differences in the 1.15 versions are due to the fact that I created the build with the msys console and the runtimeCPPinstall target and that builds a debug version and not a release version.

comment:7 by Niklas Worschech, 5 years ago

PR https://github.com/OpenModelica/OpenModelica/pull/817 restructures the system library so that only the part that is needed is linked to the cpp fmu.

comment:8 by Niklas Worschech, 5 years ago

I built the cpp runtime with the BUILDTYPE=RELEASE flag and then the size for 1.15 version is 2.7 MB

comment:9 by Rüdiger Franke, 5 years ago

With today's nightly build I can confirm that the size of the Integrator FMU/DLL reduced to 760KB/2980KB, which is not that much more than 693KB/2780KB without OMSI.

comment:10 by Rüdiger Franke, 5 years ago

... but attempting to simulate a model with the Cpp runtime from OMEdit under Win32, I get the error:

"libOMCppExtensionUtilities.dll was not found. Reinstalling the program may fix this problem."

comment:11 by Niklas Worschech, 5 years ago

I used this commands to reproduce Error:

loadModel(Modelica); getErrorString();
importFMU("Modelica.Blocks.Continuous.Integrator.fmu"); getErrorString();
loadFile("Modelica_Blocks_Continuous_Integrator_me_FMU.mo"); getErrorString();
simulate(Modelica_Blocks_Continuous_Integrator_me_FMU); getErrorString();

But I git the error message:
Modelica_Blocks_Continuous_Integrator_me_FMU.mo:77:7-77:37:writable] Error: Operator reinit may only be used in the body of a when equation.

Is there a problem with the importFMU function?

in reply to:  11 comment:12 by Vitalij Ruge, 5 years ago

Is there a problem with the importFMU function?

#5621

comment:13 by Francesco Casella, 5 years ago

@rfranke, from comment:9 it looks the issue you raised in this ticket was fixed.

If there are other problems because of missing dll's, and they are still there, would you mind opening a separate ticket?

Thanks!

comment:14 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:15 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:16 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.