Opened 8 years ago

Last modified 6 years ago

#4071 closed discussion

Performance of new front end — at Initial Version

Reported by: Francesco Casella Owned by: Per Östlund
Priority: high Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc:

Description

I have tried to get some preliminary results on the performance of the new front-end with a simple test model, reported here

package P
  model M0
    Real x, y, z;
    Real a, b, c;
    Real d, e, f, g;
  equation
    x = b;
    y = 2*x + a;
    z - x = 0;
    a = 10;
    b - a = 15;
    c + a - 2 = 14;
    d = 40;
    e = 0;
    f = 50;
    c+ d+ e +x +a = 0;
  end M0;
  
  model M
    M0 m01;
    M0 m02;
    M0 m03;
    M0 m04;
    M0 m05;
  end M;
  
  model S
    M m1;
    M m2;
  end S;
end P;

model S
  P.M m1;
  P.M m2;
  ...
  P.M m10000;
end S;

Model M0 has 10 variables and equations. Model M contains 5 instances of model M0, so it has 50 variables. Model S contains 10000 instances of M, so it has half a million equations. This test case has no physical meaning, but its structure is representative of many large-scale models, which contain large numbers of instances of the same basic models.

I have run instantiateModel(S) with and without -d=newInst on my i5 4200 @1.6 GHz, using OpenModelica-v1.11.0-dev-127-g043a756-64bit on Windows 10. These are the results

Time [s] Memory [MB]
oldInst 120 4500
newInst 25 2700

The good news is that the performance has improved significantly: about a factor 5 in terms of speed, and about a factor 2 in terms of memory, which is not bad.

On the other hand, I was hoping for a much more drastic improvement. The performance with newInst is around 20000 equations/s, which seems to me still quite slow, and about 5 kB/equation, which still seems to me an excessive amount of memory. I have tried a test case with half instances in model S, and both time and memory is halved, so it makes sense to compute this kind of average quantities.

Note that the model doesn't have connections, doesn't use inheritance, and only uses basic Real types. At the end of the day is just re-instantiating the same model over and over again.

Q1: are there further optimizations possible, to exploit the repeated instances of the same class

Q2: can you explain the memory usage of 5 kB for each variable/equation?

Change History (1)

by Francesco Casella, 8 years ago

Attachment: TestNewInst.zip added

Test models

Note: See TracTickets for help on using tickets.