Skip to content

A model that fails records no time for the phase it failed in #308

Description

@adrpo

A model that fails in a phase records no time for that phase, so the work it did disappears from every report. Only exectime still counts it, and nothing displays exectime per phase.

Three models of BuildingSystems in the last master run:

model                                                total  parse  fe  be  sc  tpl  comp  finalphase
BuildingSystems.Buildings.Zones.Examples.SingleZo...   666      3   0   0   0    0     0           0
BuildingSystems.Buildings.Zones.Examples.SingleZo...   666      3   0   0   0    0     0           0
BuildingSystems.Buildings.Zones.Examples.SingleZo...   666      3   0   0   0    0     0           0

Eleven minutes each, reported as zero seconds everywhere. The .err file says what really happened - and it is not an error, it is a timeout:

translateModel(BuildingSystems.Buildings.Zones.Examples.SingleZoneThermal3x3x3, ...) [Timeout 660]
Thread is still alive.
Aborted the command.
[Calling os._exit(0), Time elapsed: 665.8362961709499]

660 seconds is ulimitOmc, the budget for translating a model. They spend all of it, are killed, and are recorded as having spent nothing.

Why

testmodel.py reads the timers after translateModel and only assigns a phase its time when the following timer has a value:

if backend != -1:
  execstat["frontend"] = frontend - backend
  if templates != -1:
    execstat["backend"] = backend - simcode
    ...
else:
  execstat["phase"] = 0
  execstat["frontend"] = frontend

The last branch does set frontend, but frontend is timerTock(RT_CLOCK_FRONTEND), which is -1 when the front end never finished - so a model that dies there stores -1 or 0, not the eleven minutes it spent. The same holds one level down for the back end.

How much

Summed over the last master run, 19566 models, 82.5 hours of exectime:

hours
accounted for by the phase columns 77.6
attributed to no phase at all 4.9

and by how far the model got:

finalphase models hours of which unattributed
7 Verify 10016 34.9 2.0
0 Failed 881 5.0 1.5
6 Simulate 7605 28.4 1.3
1 FrontEnd 301 1.3 0.1
5 Compile 588 12.1 0.1

So 881 models cost five hours of every run and produce nothing, and a third of that time is not visible in any phase. The rest of the unattributed time is process start-up, loading the result file and so on, spread thinly over the models that succeed.

Those 881 are two different things, and the reports cannot tell them apart either:

models hours
fail quickly 878 4.5
time out in translateModel (>600 s) 3 0.6

The 878 average eighteen seconds each, most of which is loading the library before failing - they are cheap individually and add up only because there are so many. The three are BuildingSystems models that consume the full 660 second budget every single run.

What to do

Record what a phase cost even when it fails. The wall clock is available - testmodel.py already measures exectime around the whole run of a model - so a failing phase can be charged with the time between entering it and giving up, rather than with nothing.

The .err file of a failing model already holds the diagnosis, and it is published beside the results, so a report that says "these models fail and cost this much" can link straight to it. Today one has to know the model failed, find its page, and open the file.

Worth deciding as part of it:

  • whether a failed phase's time belongs in the same column as a successful one, or in a column of its own. The same column is more useful for "where does the run go"; a separate one keeps "how long does the front end take when it works" clean.
  • whether the reports should show it. A row saying 881 models spent 5 hours failing in the front end is worth more than the same 5 hours spread invisibly over exectime.

Why it matters

It came up while looking at where a master run spends its 82.5 hours, and the answer was distorted by exactly this. Anyone doing that investigation reaches for the phase columns, and they quietly under-report the models that fail - which are the models most likely to be worth looking at.


Generated by Claude Code.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions