Skip to content

ci(measure): each side runs as shards on runners of their own, merged back into measure-head and measure-base - #1311

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

DrunkOnJava merged 4 commits into
mainfrom
ci/measure-shards

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Summary

Measure is the repository's bottleneck: an unfiltered run takes 41 to 48 minutes, and every change to an export needs one before it lands. The Measure step is CPU-bound (run 41748430211: 164 task-minutes in a 43-minute step on one 4-core runner, 3.8 tasks at once). This runs each side as shards on runners of their own, so the wall time is the largest shard's instead of the sum:

shard Measure step in run 41760244593 (4-core runner, after about 2.5 min of setup)
office as built (nordic-office-as-built) 9.0 min (run 41761654404)
office at permit (nordic-office-permit) 9.1 min
samples (every release) about 9 min (each third took 2.9 to 3.4 min)
rest: reference, R2025, terrain, held-out, spent and BIMcollab models, and the families 14.7 min (run 41761654404)

That is four jobs a side, eight for a run with base, against two before; the account's limit is 40 concurrent jobs and Measure uses Linux runners only. A run given models, sample_years or probe_pair_release keeps one shard ("all"), as before (a pair probe needs both releases' samples on one runner); a pull request's run is one "rest" shard per side, as before. The first version split the samples in three; e3980ad makes them one shard, since a third scored in 3 minutes and kept a runner for 5.

Changes

  • .github/workflows/measure.yml: a plan job builds the matrix (side x shard) from the inputs; the measure job takes its fetches, MEASURE_MODELS, MEASURE_SKIP, FAMILY_DIR, SAMPLE_DIR and the samples' year range from its shard; each shard uploads measure-<side>-<shard> with runner-<shard>.txt and vmstat-<shard>.log; Compare merges each side's shards (disjoint models) into measure-head and measure-base, diffs them as before (runner*.txt excluded), and uploads the merged directories under the old names, so gh run download -n measure-head and every reader keep working. The timing job is unchanged.
  • The refs are resolved to full SHAs once, in plan, and every shard checks those out, so a branch that moves during a run (shards start minutes apart) cannot give one side two commits. The merged measure-head and measure-base are uploaded before the summary, so a summary over GitHub's limit cannot lose them, and the scorer diff is uploaded even then. One shard per side saves the Rust cache; the per-shard artifacts are kept 7 days (ba0542c, from the second read).
  • tools/ci/measure-reference-models.sh: MEASURE_SKIP, patterns of models to leave out (the rest shard skips the two office files).

Testing

  • actionlint (no new finding) and bash -n; the plan job's Python run on four input sets (unfiltered with base: 12 jobs; pull request: 1 shard per side; filtered models: 1; pair probe: 1).
  • Proof: at main cebe1635, this branch's sharded runs 41760244593 (6 shards) and 41761654404 (4 shards, e3980ad) and main's unsharded run 41760252584 with the same inputs (-f base=none -f nordic=true -f r2025=true -f samples=true -f holdout=true); every output file must be identical (logs, timings, vmstat and runner names aside), and the wall times are compared. Result (after merge): the merged measure-head of the 6-shard run 41760244593 and the 4-shard run 41761654404 are each identical to the unsharded run 41760252584, file for file (diff -rq excluding only *.log, timings*, vmstat* and runner*; the extra files are the per-shard runner and vmstat logs, 10 and 6). Wall time, dispatch to Compare: unsharded 44 min, 6 shards 21 min, 4 shards 18 min. The remaining long shards (samples 11.7 min, rest with the held-out models 14.7 min) are split in ci(measure): the samples run in two halves by release and the held-out models in a shard of their own (#1237) #1318.

Legal and contribution hygiene

  • Apache-2.0.

Related issues

Refs #1237 (Measure speed).

…o BIM4LCA office files, the samples in three ranges of releases and the rest, merged back into measure-head and measure-base
…the merged artifacts are uploaded before the summary (#1237)
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) November 4, 2026 02:43
@DrunkOnJava
DrunkOnJava merged commit 46aa05f into main Nov 4, 2026
34 checks passed
@DrunkOnJava
DrunkOnJava deleted the ci/measure-shards branch November 4, 2026 02:50
DrunkOnJava added a commit that referenced this pull request Nov 4, 2026
Resolves measure.yml against the sharded layout (#1311): the score cache is keyed per shard and by the measured SHA, a run given models restores the other shards' caches too, and each shard writes its own score-cache-<shard>.log.
DrunkOnJava added a commit that referenced this pull request Nov 4, 2026
…t models in a shard of their own (#1237) (#1318)

## Summary

#1311's four shards a side left two long ones. In run 41761654404
(cebe163, every model and the samples):

| shard | Measure step |
|---|---:|
| office as built | 9.0 min |
| office at permit | 6.1 min |
| samples, every release | 11.7 min |
| rest, with the 18 held-out and the spent models | 14.7 min |

This splits the two long ones:

- **Samples:** two halves by release, 2008 to 2023 and 2024 to 2099 (477
and 658 MB of models; 2024 alone is 328 MB). #1311's first version ran
them in thirds at 2.9 to 3.4 minutes each.
- **Held-out:** the held-out and spent models get a shard of their own,
`holdout-* spent-*`, since the held-out fetch brings both. "Rest" no
longer fetches them.

That makes six jobs a side, twelve with base; the account's limit is 40
concurrent jobs.

Unchanged: a pull request's run (one "rest" shard per side) and a
filtered or pair run (one "all" shard). Changed besides the two long
shards: a run with `holdout` but no `nordic` or `samples` now gets
"held-out" and "rest", not one "rest" shard with the held-out fetch on.

The second read ran the plan for all 64 combinations of `nordic`,
`samples`, `r2025`, `holdout`, `bimcollab` and `families`, against the
unsharded model set. Every combination measured each model and sample
exactly once, and head and base always got the same shards. It also
checked custody: the held-out scrub runs in every shard before upload,
and "rest" no longer fetches held-out files.

## Proof

Measure 41765200637 runs this branch (at 5336512, the first seam) at
main cebe163 with the same inputs as runs 41760252584 (unsharded),
41760244593 (6 shards) and 41761654404 (4 shards). Those three already
give byte-identical `measure-head` output, every file but the per-shard
runner and vmstat logs. This run is held to the same diff; its wall time
goes here when it is in: RESULT.

## Legal and contribution hygiene

- [x] Apache-2.0.

## Related issues

Refs #1237, #1311.
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 added a commit that referenced this pull request Nov 4, 2026
…e Actions cache and saved from main (#1237) (#1322)

## 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

- [x] 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.
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