Opened 4 years ago

Closed 3 years ago

#4992 closed defect (fixed)

Bad scalability of large group member sets in BiPgraph

Reported by: jsten Owned by: jsten
Priority: major Milestone: 2.0.x
Component: Modelica/MiddleEnd Version: trunk
Keywords: #4991. Cc:

Description (last modified by jsten)

The BiPGraph handles big non-scalar equations really bad. Example of such equations are algorithms which assigns big variable vectors. One of the problems is that the group member list isn't the same list for all group members. Instead one list is allocated for each group member, however all the lists for the group members contains the same information. This can be made more efficient!

Example model:

model A
    constant Integer n = 10000;
    Real a[n];
algorithm
    a[1] := time;
    for i in 2:n loop
        a[i] := a[i - 1] + 1;
    end for;
end A;

This is a part of #4991.

Attachments (1)

patch.patch (44.4 KB) - added by jsten 4 years ago.
Partial solution of this problem

Download all attachments as: .zip

Change History (11)

comment:1 Changed 4 years ago by jsten

Description: modified (diff)

Changed 4 years ago by jsten

Attachment: patch.patch added

Partial solution of this problem

comment:2 Changed 3 years ago by jsten

changeset:9014
Fixed two complexity bugs in BiPGraph:

  1. Group members did not share the group member list
  2. Printing of the graph caused printing of the same, large, algorithm n times.

Also added a limit to the number of scalar equations there can be, set it to 1000 for now.

comment:3 Changed 3 years ago by jsten

changeset:9020
Fixed tests broken in r9014.

comment:4 Changed 3 years ago by jsten

changeset:9030
Fixed scalability bugs related to handling of algorithms in tarjan and BLT related code.

comment:5 Changed 3 years ago by jsten

r9030 resolves the last issues for the model in the ticket. However this model causes further problems:

model B
    constant Integer n = 10000;
    Real a[n];
    Real b;
algorithm
    a[1] := b;
    for i in 2:n loop
        a[i] := a[i - 1] + 1;
    end for;
equation
    b * a[n] = time;
end B;

comment:6 Changed 3 years ago by jsten

Another model that causes problems:

model C
    constant Integer n = 10000;
    Real a[n];
algorithm
    when sample(0, 1) then
        a[1] := time;
        for i in 2:n loop
            a[i] := a[i - 1] + 1;
        end for;
    end when;
end C;

comment:7 Changed 3 years ago by jsten

Resolution: fixed
Status: newclosed

changeset:9034
Improved scalabilty for algorithms with a lot of scalars.

comment:8 Changed 3 years ago by jsten

The following model fails after r9034:

model A
    Real a,b,c,d,e;
equation
    a = time + d * 2;
    e = a * 2 - d;
    d = c * 2 + a;
algorithm
    when e > 0 then
        b := pre(d) + 1;
        c := b / 2;
    end when;
end A;

comment:9 Changed 3 years ago by jsten

Resolution: fixed
Status: closedreopened

comment:10 Changed 3 years ago by jsten

Resolution: fixed
Status: reopenedclosed

changeset:9046
Fixed regression introduced in r9034. Jacobian calculation no longer assumes that SimpleEquationBlocks are scalar.

Note: See TracTickets for help on using tickets.