Repository navigation
ci(measure): mesh_bodies_vs_ifc scores its bodies on every CPU and skips the sliver pairs that cannot be nearest, with the same output (#1237) - #1320
Merged
Conversation
…ips the sliver pairs that cannot be nearest, with the same output (#1237)
…an unreadable RVT_MESH_WORKERS means the CPU count, and the sample note says what a zero's sign does
DrunkOnJava
marked this pull request as ready for review
November 4, 2026 04:23
DrunkOnJava
enabled auto-merge (squash)
November 4, 2026 04:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tools/re/mesh_bodies_vs_ifc.pyscores its bodies on every CPU, finds the vertices of a body with a lexsort instead ofnp.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'ssaved_meshes_vs_ifc215 s,schema-validate168 s andwall_heights_vs_ifc149 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_ifcmeshes first in the same task):mesh_partsreads 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.surface_distancecalls: 622 exhaustive ones 4.3 s, 446 pruned ones 32.6 s. cProfile:distances27.1 s,sample(np.unique(axis=0)) 3.9 s,ifcopenshell.open3.4 s for both files.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 bothsurface_distancecalls) is one task of a fork process pool over the CPUs (RVT_MESH_WORKERSsets the count, as formesh_parts), heaviest first, collected intagsorder, 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.insidecannot be trusted, so its plane distance (|height|, whichdistancesgives 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 samedistancesarithmetic as before.samplesorts the vertices withnp.lexsortand drops repeats, which isnp.unique(axis=0)without its structured-array comparison.getppidcheckifc_common.mesh_partsuses), and anRVT_MESH_WORKERSthat is not a number means the CPU count.ifc_common.py, the cache paths,measure.ymlormeasure-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,sample0.7.Threads instead of processes: 16.0 s against 13.1 s on 4 CPUs (run 41763294622), so processes.
sample: byte-identical tonp.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, scorerssaved_meshes_vs_ifc mesh_bodies_vs_ifc):mesh_bodies_vs_ifc.txtbyte-identical (cmp) head against base on all 7 models, emptycompare-scorer-diff.Unfiltered Measure,
base=main nordic r2025 samples holdout(run 41767184413, head 6cc6702): the scorer diff has nomesh_bodies_vs_ifcline (its one entry is the base side's missing terrain models, a BIM4LCA host failure handled in ci(measure): the BIM4LCA office and R2025 models are restored from the Actions cache and saved from main (#1237) #1322), andcmpfinds the office permit and as-builtmesh_bodies_vs_ifc.txtbyte-identical head against base.What that run's step times do not show:
mesh_bodies_vs_ifctook 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, andsaved_meshes_vs_ifcin 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.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"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 undertools/re/only)Audit-honesty checklist
changelog.d/fragmentfork(Linux, macOS), asmesh_partsdoesLegal and contribution hygiene
Breaking changes
None. The scorer's output is byte-identical.
Output samples
Run 41765844976,
cmpofmesh_bodies_vs_ifc.txt, head against base:Related issues
Refs #1237, as #1311 and #1318 (the shards) do.