build(c++): report machine flags used - #211
Merged
Panadestein merged 13 commits intoAug 13, 2026
Merged
Conversation
robertodr
requested review from
adamglos92,
diagonal-hamiltonian,
fpietra and
ludmilaasb
as code owners
August 6, 2026 19:37
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 7, 2026 08:17
2f71aa3 to
964f036
Compare
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 7, 2026 08:22
ace65b2 to
9cf5662
Compare
|
Docs preview: https://pr-211.monoprop-docs.pages.dev |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor-use-hwloc #211 +/- ##
===================================================
Coverage 97.70% 97.70%
===================================================
Files 14 14
Lines 742 742
Branches 98 98
===================================================
Hits 725 725
Misses 12 12
Partials 5 5
Flags with carried forward coverage won't be shown. Click here to find out more. |
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 7, 2026 12:28
fd4f296 to
e0da3d3
Compare
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 10, 2026 08:40
8a2789c to
45738c6
Compare
ludmilaasb
reviewed
Aug 10, 2026
robertodr
dismissed
ludmilaasb’s stale review
August 10, 2026 18:51
The merge-base changed after approval.
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 10, 2026 18:51
8729620 to
7edf3cd
Compare
robertodr
force-pushed
the
build-report-machine-flags-used
branch
2 times, most recently
from
August 11, 2026 09:33
8e8111f to
6a207bb
Compare
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 13, 2026 09:01
6a207bb to
0129dbd
Compare
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 13, 2026 09:44
0129dbd to
984742c
Compare
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 13, 2026 09:57
984742c to
20e1219
Compare
Panadestein
approved these changes
Aug 13, 2026
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 13, 2026 10:20
20e1219 to
2cc7c5b
Compare
Assisted-by: GitHub Copilot, gpt-5.3-codex
robertodr
force-pushed
the
build-report-machine-flags-used
branch
from
August 13, 2026 10:23
2cc7c5b to
710790e
Compare
|
diagonal-hamiltonian
added a commit
that referenced
this pull request
Aug 13, 2026
Brings in #203 (implementations split into source/inline files), #208 (hwloc replaces the custom topology discovery), #211, #223, #148 and #224. Resolves the conflict that had left this PR with no CI: GitHub cannot recompute refs/pull/166/merge while the merge conflicts, so the pull_request workflows produced no runs at all and only the pull_request_target labeller was firing. Four files conflicted; the rest auto-merged. Two were unions of independent additions (AGENTS.md, parallelism.mdx) -- in the latter, main's wording for the monoprop_PARTITION_PINNING row is now the accurate one, since hwloc replaced the Linux-only /sys path. The substantive resolution is CpuTopology. #208 rewrote discovery onto hwloc, which is the better mechanism and is kept wholesale, but it also reinstated the placement bug this branch exists to fix: enumerate_physical_cores() filters by the calling thread's affinity, and placement_order() then rejects the request when group_count * n > cores.size(), so a rank holding a launcher-assigned slice divides an already-divided machine and silently runs unpinned. That is the mechanism measured at 437 us/sync against 15.5 us/sync placed. So this keeps main's hwloc discovery and re-applies the fix on top of it, rather than keeping either side's file: - NodeMask, classify_node_mask() and this_thread_cpumask() return, with the PerRank collapse moved into partition_cpusets() so placement_order() stays pure and hardware-free the way #208 factored it. - CpuMask replaces cpu_set_t as the exchanged type, since main's CpuSet is now a single PU rather than a mask. It is a fixed-size POD because PartitionGroup ships it through MPI_Allgather as MPI_BYTE, and being hwloc-free makes classify_node_mask() unit-testable without live hardware. 4096 bits rather than glibc's CPU_SETSIZE of 1024: a PU index past the mask is invisible to the disjointness test, which would misread a per-rank split as shared. - pin_this_thread() reports whether the affinity took, which CommProfile's pinned count needs to tell "nothing was pinned" apart from "one domain per rank" when barrier_groups is 0. - cpuset_domains() returns, so the two-level barrier keeps deriving its domains from the placement rather than from the placement logic. Verified on a Deucalion login node, against live hwloc and real launcher bindings, that the collapse is load-bearing and does not disturb the shared case. Same live mask, same call, only the classification differs: 2 ranks, --map-by slot:PE=4 --bind-to core, n=4 => PerRank as Shared (== main's unconditional divide): 0 cores placed as PerRank: 4 cores placed 2 ranks, PE=8, n=8 => PerRank: 0 vs 8 2 ranks, --bind-to none, n=4 => Shared: 4 vs 4 AGENTS.md records the trap under Architecture Overview, including that it has now regressed once, because the guard lives in the placement policy and not in discovery -- so a future rework of that layer has to re-check it. cpu_topology_policy_per_rank_slice_starves_without_collapse pins the mechanism deterministically, without live hardware. Gates on the merged tree (hwloc 2.12.1, already provided transitively by foss/2025b, so hpc/deucalion/env.sh needs no change): - ctest -L serial: 224/224 passed, 0 failed, 412 s - fabric-exclusion scoping still correct: 224/224 serial carry it, 0/1 mpi do - cpu_topology: 14/14 cases, 185 assertions, with per-case assertion counts confirming the two live restricted-mask cases asserted rather than early-returning - rank_count_matches_under_an_asymmetric_emit_gate and zero_cutoff_upper_atol_zero_is_exact_World: pass at 1, 2 and 4 ranks Unchanged by this merge and still open: shm_comm_oversubscribed_repeated_collectives aborts under 2 ranks on main as well as here, so ctest -L mpi remains unusable as a gate; and the layout A build_graph ~1.1x regression is still unexplained. Assisted-by: ClaudeCode:claude-opus-5
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
🤖 AI text below 🤖
This pull request introduces reporting of machine-dependent compiler flags (such as those set via
-march) used to build the project. It adds a mechanism to query, clean, and expose the actual flags used for the active variant, making this information available at both the C++ and Python levels. Additionally, it introduces a utility script and its tests for parsing GCC target options.Machine-dependent flags reporting and variant introspection:
_monoprop_query_machine_flags) to query and clean the machine-dependent flags used for each build variant, storing them in CMake variables and generating a new header (Variants.h) with compile-time functions to report the active variant and flags. [1] [2]Info.h.inand the C++ bindings to expose the active variant and its compiler flags viavariant()andvariant_flags()functions, which are now also accessible in Python asmonoprop.__variant__andmonoprop.__compiler_flags__. [1] [2] [3] [4] [5] [6]Utility script and testing:
tools/gcc-target-help-clean.py, a script to normalize the output ofgcc -Q --help=target, and a corresponding test suite to ensure robust parsing and cleaning of compiler flag output. [1] [2]CMake and source organization:
VariantMacros.h,Info.h, etc.) are included in the public interface and properly listed in the CMake configuration.These changes improve transparency into the build environment, facilitate reproducibility, and make it easier to debug and optimize builds for different architectures.
Checklist
docs/,CONTRIBUTING.md) if neededCHANGELOG/ release notes updated if applicableAI/LLM disclosure
Important
By opening this PR I confirm that I have read CONTRIBUTING.md and I agree to the terms of the Contributor License Agreement.
Warning
If you're contributing on behalf of your employer, contact cla@algorithmiq.fi to arrange a Corporate CLA.