Skip to content

ci(measure): the BIM4LCA office and R2025 models are restored from the Actions cache and saved from main (#1237) - #1322

Merged
DrunkOnJava merged 4 commits into
mainfrom
ci/measure-model-cache
Nov 4, 2026
Merged

DrunkOnJava merged 4 commits into
mainfrom
ci/measure-model-cache

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Since #1311 and #1318, each office shard and the "rest" shard of both sides fetch the BIM4LCA office files, so up to six jobs ask VTT's host for them at once. In run 41767184413, base "rest" waited 27 minutes on that host (03:32 to 03:59 UTC) before giving up. The terrain models were then NOT MEASURED on that side, and the R2025 archive and a held-out file also failed to download there.

Measure now keeps these models in the Actions cache:

  • BIM4LCA office files (VTT, CC BY-SA 4.0): restored into _bim4lca-measure, checked against their pins, and hard-linked into models/. This is how CI's corpus job already keeps its BIM4LCA models. fetch-bim4lca.py asks the host only for files that are missing or fail their pin.
  • puzzbobb's R2025 models (Apache-2.0): restored into _r2025, keyed on the pins and on the fetch script; on a miss they are fetched as before.
  • Saving: both caches are saved from runs on main only, after a fetch that verified every file.
  • Held-out models: they carry no licence, are never cached, and keep fetching per run.

Testing

  • actionlint finds nothing new.
  • Measure 41772557042 runs this branch on the permit office and one R2025 model with no cache, which exercises the miss path. A run from a branch does not save, so the hit path is first seen on the next main run after the merge. Its fallback is the fetch as before.

Legal and contribution hygiene

  • Apache-2.0. The BIM4LCA files' CC BY-SA 4.0 and the R2025 models' Apache-2.0 allow keeping copies. Nothing is committed.

Related issues

Refs #1237.

…e Actions cache and saved from main, so six shards no longer fetch them at once (#1237)
DrunkOnJava added a commit that referenced this pull request Nov 4, 2026
…ips the sliver pairs that cannot be nearest, with the same output (#1237) (#1320)

## Summary

`tools/re/mesh_bodies_vs_ifc.py` scores its bodies on every CPU, finds
the vertices of a body with a lexsort instead of `np.unique(axis=0)`,
and skips the sliver triangles that cannot be a point's nearest. Every
line it prints is the same on every model.

## Motivation

The scorer took 75 to 85 s of each BIM4LCA office shard (run
41760244593's `timings.log`, EPYC 7763; the shard's
`saved_meshes_vs_ifc` 215 s, `schema-validate` 168 s and
`wall_heights_vs_ifc` 149 s are longer steps), all of it on one CPU. On
the faster runners of run 41767184413 the old scorer took 14 to 16 s.
Follows #1311, which shards each side.

Where its time goes, measured on the office permit pair (a warm mesh
cache, as in Measure, where `saved_meshes_vs_ifc` meshes first in the
same task):

- Meshing is not the cost in Measure: `mesh_parts` reads both files'
bodies from the cache in 0.0 s (run 41762111248). Alone and cold it is
13 s for rvt-rs's IFC and 56 s for Revit's (run 41762114063), which the
cache already removes.
- The scoring loop is 41.2 s of 46.0 s (a fast runner), 1,068
`surface_distance` calls: 622 exhaustive ones 4.3 s, 446 pruned ones
32.6 s. cProfile: `distances` 27.1 s, `sample` (`np.unique(axis=0)`) 3.9
s, `ifcopenshell.open` 3.4 s for both files.
- Inside the pruned path (run 41763294622, instrumented `distances`):
the sliver pass, 25,117 calls of 8 triangles against every point, is
16.6 s of the 34.9 s serial loop.

## Changes

- `tools/re/mesh_bodies_vs_ifc.py`:
- `score_pair` / `score_all`: each body (its volume ratio and both
`surface_distance` calls) is one task of a fork process pool over the
CPUs (`RVT_MESH_WORKERS` sets the count, as for `mesh_parts`), heaviest
first, collected in `tags` order, so the printed rows and rankings are
built from the same values in the same order. Fewer than 16 bodies, or
one CPU, score in this process; a dead worker falls back to scoring in
this process.
- the sliver pass measures a point against a sliver only when the point
is within the nearest distance found plus the slack of the sliver's box
or of its plane. A sliver's `inside` cannot be trusted, so its plane
distance (`|height|`, which `distances` gives for a point it takes as
inside) is part of the bound, and the distance to any of its three edges
is no less than the distance to its box. A pair that is measured goes
through the same `distances` arithmetic as before.
- `sample` sorts the vertices with `np.lexsort` and drops repeats, which
is `np.unique(axis=0)` without its structured-array comparison.
- a worker stops at its next body when its parent has died (the
`getppid` check `ifc_common.mesh_parts` uses), and an `RVT_MESH_WORKERS`
that is not a number means the CPU count.
- No change to `ifc_common.py`, the cache paths, `measure.yml` or
`measure-reference-models.sh`.

## Testing

Unit tests are banned in this repository: none added. Checked end to end
on the BIM4LCA office files (CC BY-SA 4.0,
`research/bim4lca-measure.tsv`) in Measure:

- Same-process A/B on one runner (EPYC 7763, run 41764599268, the office
permit pair, 534 bodies): the main-branch scorer 40.7 s serial; this
scorer 21.9 s serial and 8.9 s with 4 processes; all 534 x 3 results
(volume ratio and both distances) equal as floats, 0 mismatches
(`res_new == res_old`). The stages of the 21.9 s: setup 0.9, block
bounds and seeds 5.0, pair pass 4.4, sliver pass 6.1 (6.9 M of 78 M
sliver pairs measured), exhaustive about 3.5, `sample` 0.7.
- Threads instead of processes: 16.0 s against 13.1 s on 4 CPUs (run
41763294622), so processes.
- `sample`: byte-identical to `np.unique(axis=0)` on all 1,068 samples
of the office pair.
- Filtered Measure with `base=main` (run 41765844976, models: both
office files, core-interior, re1-architecture, three r2025 models,
scorers `saved_meshes_vs_ifc mesh_bodies_vs_ifc`):
`mesh_bodies_vs_ifc.txt` byte-identical (`cmp`) head against base on all
7 models, empty `compare-scorer-diff`.
- Unfiltered Measure, `base=main nordic r2025 samples holdout` (run
41767184413, head 6cc6702): the scorer diff has no `mesh_bodies_vs_ifc`
line (its one entry is the base side's missing terrain models, a BIM4LCA
host failure handled in #1322), and `cmp` finds the office permit and
as-built `mesh_bodies_vs_ifc.txt` byte-identical head against base.
- What that run's step times do not show: `mesh_bodies_vs_ifc` took 19.5
s (permit, EPYC 9V74) and 16.5 s (as-built, EPYC 9V45) on the head side,
14.5 s (EPYC 9V45) and 15.6 s (Xeon 6975P-C) on the base side. Head and
base ran on different CPUs, and `saved_meshes_vs_ifc` in the same runs
took 164 s and 134 s against 119 s and 142 s, so those times compare
machines, not code. The same-process A/B above is the evidence of the
gain; a same-runner measurement of the whole shard has not been made.

- [x] Verified end to end on real Revit files: the command, the files
and the result are above; the reproduce command is `gh workflow run
measure.yml --ref <ref> -f ref=<sha> -f base=main -f nordic=true -f
models="nordic-office-*" -f scorers="saved_meshes_vs_ifc
mesh_bodies_vs_ifc"`
- [x] If this is a performance change: the before / after is above
(Measure, not `tools/bench.sh`, which times the exporter)
- [ ] `tools/check-local.sh`: not run (no Rust, workflow or
documented-behaviour change; a Python scorer under `tools/re/` only)

## Audit-honesty checklist

- [x] README / docs: no claim changes
- [x] No user-visible change, so no `changelog.d/` fragment
- [x] No new limitation. The pool is a fork pool, so the scorer needs a
platform with `fork` (Linux, macOS), as `mesh_parts` does
- [x] No emojis, no private paths or addresses

## Legal and contribution hygiene

- [x] Apache-2.0
- [x] No Autodesk proprietary source or SDK content
- [x] No new fixtures

## Breaking changes

None. The scorer's output is byte-identical.

## Output samples

Run 41765844976, `cmp` of `mesh_bodies_vs_ifc.txt`, head against base:

```
nordic-office-permit identical
nordic-office-as-built identical
core-interior identical
re1-architecture identical
r2025-12_Rooms_Door_Windows identical
r2025-13_Rooms_Stairs identical
r2025-17_Rooms_Stairs_Spiral identical
```

## Related issues

Refs #1237, as #1311 and #1318 (the shards) do.
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) November 4, 2026 04:39
@DrunkOnJava
DrunkOnJava merged commit af5e683 into main Nov 4, 2026
35 checks passed
@DrunkOnJava
DrunkOnJava deleted the ci/measure-model-cache branch November 4, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant