Opened 9 years ago

Closed 7 years ago

#3625 closed task (fixed)

Extremly long compilation time

Reported by: Christian Kral <dr.christian.kral@…> Owned by: Adrian Pop
Priority: high Milestone: 1.13.0
Component: Frontend Version:
Keywords: Cc: Adrian Pop, Per Östlund

Description

When I use a Modelica library that reads input parameters from an external data file and writes other data to an external data file, sometimes unusual long compilation times occur. The external data a read by means of a C function. Data writing is with Modelica.Utilities.

Please compare the compilation times by the attached two examples (load KeyWordIO first)

  • TestKeyWordIO.RLOn (approx. 1 second)
  • TestKeyWordIO.RLOn_io (approx. 20 seconds)

Note that the model complexity of both models is equal; the only difference are the reading and writing of data files in the second example.

In other examples the compilation time goes up to several minutes !

Attachments (4)

KeyWordIO.mo (15.7 KB ) - added by Christian Kral <dr.christian.kral@…> 9 years ago.
Handling input and output of data files
TestKeyWordIO.mo (4.2 KB ) - added by Christian Kral <dr.christian.kral@…> 9 years ago.
Test examples to be compared
input.dat (21 bytes ) - added by Christian Kral <dr.christian.kral@…> 9 years ago.
Input data file
script.mos (252 bytes ) - added by Adeel Asghar 9 years ago.

Download all attachments as: .zip

Change History (15)

by Christian Kral <dr.christian.kral@…>, 9 years ago

Attachment: KeyWordIO.mo added

Handling input and output of data files

by Christian Kral <dr.christian.kral@…>, 9 years ago

Attachment: TestKeyWordIO.mo added

Test examples to be compared

by Christian Kral <dr.christian.kral@…>, 9 years ago

Attachment: input.dat added

Input data file

comment:1 by Adam Dershowitz, 9 years ago

I tried to run your code, on a few different versions of OM. On two different versions on Linux VM, RLOn_io fails to compile with undeclared identifiers as errors. While, on a Mac with a few day old dev version of OM, it actually crashes OM when I try to run it.
Neither really explains your problem, but something is definitely odd about what is going on.

comment:2 by Adeel Asghar, 9 years ago

Cc: Adrian Pop added

comment:3 by Adam Dershowitz, 9 years ago

I just upgraded to a newer version of OM using the nightly Linux VM, and now it does run, and does show the much longer compilation. It looks like there was a change that the undeclared identifiers is now a warning, so it works.
On the other hand, what is probably an unrelated problem, is that when I try to run this on a Mac OMEdit, it just crashes and offers to send the developers an email. Just instantiating RLOn_io crashes OMEdit, while RLOn, works fine.
If this does seem to be completely unrelated, I can create a new ticket.

comment:4 by Adam Dershowitz, 9 years ago

I did create a new ticket for this:
https://trac.openmodelica.org/OpenModelica/ticket/3627 Although, I do wonder if it could be a memory issue, in which it is attempting to grab a lot of memory...enough to slow down compilation on Linux, and crash OMEdit on a Mac? Just a thought.

comment:5 by Christian Kral <dr.christian.kral@…>, 9 years ago

Actually, it also happened under Linux, that sometimes the process crashed without finishing compilation. Then, later, it compiled without crashing, even though I did not change the code. So the crash seems not to be a Mac specific thing.

comment:6 by Adeel Asghar, 9 years ago

Cc: Per Östlund added
Component: OMEditFrontend
Owner: changed from Adeel Asghar to Adrian Pop
Status: newassigned

The issue is not related to OMEdit.

by Adeel Asghar, 9 years ago

Attachment: script.mos added

comment:7 by Martin Sjölund, 7 years ago

Both of the examples run in 0.4s for me under Linux. I will add KeyWordIO to the nightly testing so we can see what the performance difference is between different OMC versions.

comment:8 by dr.christian.kral@…, 7 years ago

I also tested the two examples again under Linux. The compile time (which was the issue of this ticket) of both the models does not show any significant difference.

Thanks for monitoring KeyWordIO.

comment:9 by Martin Sjölund, 7 years ago

I tested it again and the performance seems bad only if -d=gen, but this is not the default setting and not recommended to use (are you using it?).

comment:10 by dr.christian.kral@…, 7 years ago

I am not using the option -d=gen. I re-checked the two examples again and found they both compile in short time. I assume the issue is solved, as everything works fine now. From my point of view the ticket can be closed.

comment:11 by Francesco Casella, 7 years ago

Milestone: Future1.13.0
Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.