Skip to content

Merge aloha_obj_wmerged + add standalone_mg7 to the check language comparison#4

Closed
oliviermattelaer wants to merge 482 commits into
feat-madmatrixfrom
claude/feat-madmatrix-aloha-merge
Closed

Merge aloha_obj_wmerged + add standalone_mg7 to the check language comparison#4
oliviermattelaer wants to merge 482 commits into
feat-madmatrixfrom
claude/feat-madmatrix-aloha-merge

Conversation

@oliviermattelaer

Copy link
Copy Markdown
Contributor

Summary

  • Merge `mg5/aloha_obj_wmerged` (upstream mg5amcnlo) into `feat-madmatrix` (clean merge, no conflicts), and cherry-pick the Python value addition to the language check from `mg5/copilot/add-python-output-comparison`.
  • Repair the Fortran and C++ standalone `check` drivers, which were broken in the MadGraph7 tree (`write_check_sa` KeyError for non-merged legs, missing `dirs_to_create` on `ProcessExporterCPP`, the standalone_cpp P-dir Makefile repurposed for the mg7_v5 `api.so` build, `check_sa.cpp` using the old array-based `sigmaKin` API, `rambo.o` dropped from the model library).
  • Make the `standalone_mg7` `check_sa.exe matrix` mode reproduce the Fortran check output exactly: the phase-space point is now generated with the classic standalone RAMBO (RANMAR 1802/9373) instead of the cudacpp RAMBO (different sequence, massless-only), an optional `` argument mirrors `./check `, alpha_s is taken from the param card through `UMAMI_IN_ALPHA_S`, and the `PDG` lines print true signed PDG ids via a new generated `flavorPDGs` table.
  • Add the MG7 backend to `check language`: generate a `standalone_mg7` directory, build it, run `./check_sa.exe matrix `, and parse/match its per-flavor output exactly like the Fortran/C++ backends. `output_language` gains MG7 SA / F-MG7 rel.diff. columns and the pass criterion covers all pairwise diffs between compiled backends (Python stays informational).

Verification

Process F/MG7 rel.diff Result
e+ e- > a a 5.1e-08 Passed
g g > t t~ (massive FS, alpha_s) 6.8e-08 Passed
_quark _anti_quark > t t~ (per flavor) ~1.0e-07 Passed

`check language e+ e- > a a` via the CLI shows all four backends passing; the 9 language/flavor unit tests pass; `check_sa.exe` matrix and perf modes both run.

🤖 Generated with Claude Code

oliviermattelaer and others added 30 commits April 16, 2026 23:00
…iagram generation (#248)

* Support tuple charges in merged flavor conservation

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: oliviermattelaer <33414646+oliviermattelaer@users.noreply.github.com>
Fix wrong charm quark couplings in FD gauge Z-_quark interaction

-----
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Agent-Logs-Url: https://github.com/mg5amcnlo/mg5amcnlo/sessions/789c1924-e92f-4a0a-b767-73d4173dc29f

Co-authored-by: oliviermattelaer <33414646+oliviermattelaer@users.noreply.github.com>
Agent-Logs-Url: https://github.com/mg5amcnlo/mg5amcnlo/sessions/5462e87d-c646-4d4d-b88d-da295c70d123

Co-authored-by: oliviermattelaer <33414646+oliviermattelaer@users.noreply.github.com>
Agent-Logs-Url: https://github.com/mg5amcnlo/mg5amcnlo/sessions/c9c2f653-615a-4f19-9e7c-12ec8d9e054b

Co-authored-by: oliviermattelaer <33414646+oliviermattelaer@users.noreply.github.com>
oliviermattelaer and others added 26 commits June 11, 2026 16:33
EVA (effective vector approximation) collision tests for w+ w- > t t~ used a
bare `output`, now defaulting to mg7. Pin to `output madevent`. Verified both
pass. No mg7 equivalents: EVA is a madevent-only beam mode for now (consistent
with test_eva_collision).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`pip install ./madspace` failed on the CI runner (ubuntu-22.04 / old pip) while
preparing metadata: scikit-build-core's vendored pyproject_metadata calls
packaging.utils.canonicalize_name(..., validate=True) and references
packaging.utils.InvalidName, both introduced in packaging 22.0. The build-
isolation env was falling back to the older system packaging, raising
"canonicalize_name() got an unexpected keyword argument 'validate'" /
"module 'packaging.utils' has no attribute 'InvalidName'".

Add packaging>=22 to [build-system].requires so build isolation always installs
a compatible packaging. Verified the source build still succeeds and madspace
imports.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bare `output` now defaults to mg7; these tests all drive MadEventCmdShell /
launch / generate_events and need a MadEvent directory. Pin to `output madevent`:
test_customised_madevent_via_run_card, test_eft_running, test_complex_mass_scheme,
test_width_scan, test_e_e_collision, test_add_time_of_flight,
test_w_production_with_ms_decay, test_w_production_with_PA_decay(+inline),
test_generation_heft, test_polarization_top_decay, test_rivet_from_file.

Verified: 11/12 pass locally. test_rivet_from_file gets through output + event
generation and only fails at the local `rivet` executable step (rivet not
installed here) -- an environment issue, not the pin; it uses rivet from the
heptools cache in CI.

No mg7 equivalents in this batch: these are run-card / width / EVA-ish / MadSpin
/ rivet / decay-chain madevent features (MadSpin and these run modes are not on
the mg7 side yet).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… helpers)

Add two non-xfail mg7 cross-section trackers (per request), and refactor the
shared mg7-run helpers to module level so they are usable from any test class:

- test_e_e_collision_mg7 (e+ e- > e+ e-): mg7 has no lepton-beam support -- its
  run_card.toml only carries a hadron PDF, so generate_events aborts with
  "PID 11 not found in pdf grid". Asserts the physical 155.9 pb; red tracker.
- test_generation_heft_mg7 (HEFT g g > b b~ HIW<=1): mg7 runs but the cross
  section is ~257x below physical (~1.6e6 vs 4.117e8 pb). Asserts the physical
  reference; red tracker for the mg7 ggH-coupling normalisation.

_mg7_datadir_or_skip / _run_mg7_xsec moved from TestMECmdShell to module-level
functions (test passed as first arg) so TestMEfromfile can use them too; the
three existing callers updated. Both new tests verified to fail for the right
reasons (failures=2, no errors) and self-skip without the mg7 stack. Wired both
as (red, tracking) jobs in acceptancetest_mg7.yml.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add test_standalone_mg7_vs_cpp: generates p p > e+ e- QCD=0 and checks that the
standalone_mg7 (madmatrix) matrix elements reproduce the standalone_cpp ones.
standalone_mg7 ships a UMAMI-based check_sa.exe whose "matrix" mode is by design
identical to the Fortran/C++ check drivers; the test compares the per-flavour
MEs as sorted multisets within a relative tolerance (the backends print at
different precision and may order flavours differently). A massless final state
is used so both drivers evaluate the same default 1000 GeV phase-space point
(avoiding the energy auto-bump that the Fortran/C++ ./check applies but
check_sa.exe does not). Adds a shared _assert_me_lists_close helper and wires
the test into the acceptance workflow. Verified passing (~12s).

Note: not woven into the existing heavier comparison tests --
test_standalone_cpp_fd_output_consistency (6-particle / 104-flavour / two
gauges) becomes >30 min with a third backend, and the MSSM benchmark
test_standalone_cpp uses a massive final state where ./check auto-bumps the
energy but check_sa.exe does not; a dedicated fast massless comparison avoids
both issues.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tion)

The earlier madspace/pyproject.toml packaging>=22 build-require was not enough:
the runner ships an ancient pip (pip/_vendor/pep517, ~22.0.2) whose build
isolation still leaves scikit-build-core's vendored pyproject_metadata importing
an old packaging, so 'pip install ./madspace' keeps failing in metadata
preparation (canonicalize_name validate kwarg / packaging.utils.InvalidName,
both need packaging>=22). Upgrade pip (and packaging) in checkout_mg5 before the
madspace build so a modern pip performs build isolation correctly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…standalone

Replace standalone_cpp by standalone_mg7 (madmatrix) in the FD/unitary-gauge
consistency test: it now checks that the standalone_mg7 matrix elements agree
with the Fortran standalone ones in FD gauge, in unitary gauge, and across the
two gauges (gauge invariance). get_values drives standalone_mg7's UMAMI
check_sa.exe ('matrix' mode == the Fortran check driver), and the per-flavour
values are compared as sorted multisets via _assert_me_lists_close.

The helper gains an atol: this process's MEs are O(1e-20), i.e. at the
floating-point noise floor where the Fortran and cudacpp backends differ, so an
absolute floor (atol=1e-7) is applied -- matching the leniency the original
cpp-vs-standalone assertAlmostEqual already had there. Verified passing (~6.4 min;
test_standalone_mg7_vs_cpp still green with the backward-compatible signature).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
madspace requires Python >=3.11 but the ubuntu-22.04 runners ship Python 3.10,
so checkout_mg5's 'pip install ./madspace' fails with
"Package 'madspace' requires a different Python: 3.10.12 not in '>=3.11'".

Pin every test-CI runner to ubuntu-24.04 (Python 3.12): replace all
runs-on: ubuntu-22.04 and runs-on: ubuntu-latest with ubuntu-24.04 across the
acceptance / unittest / parallel / IOtest / aloha / warm_cache workflows, and
collapse the os: [ubuntu-22.04, ubuntu-24.04] matrices to [ubuntu-24.04]. The
lhapdf/heptools caches are keyed by $ImageOS so they track the runner image
(warm_cache now (re)builds the ubuntu-24 caches). madspace.yml (wheel publisher)
is left untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
After the standalone_cpp benchmark (g g > go go, 6.4739191), also generate
standalone_mg7 and confirm its matrix element matches standalone_cpp for this
massive BSM process. The Fortran/C++ ./check auto-bumps the CM energy to
2*total_mass for the heavy gluinos but check_sa.exe does not, so both are
evaluated at the same explicit above-threshold energy (5000 GeV). Verified
passing (~18s); standalone_mg7 reproduces standalone_cpp (5.7733905 vs
5.7733902).

This extends standalone_mg7 coverage to a massive/MSSM process, complementing
test_standalone_mg7_vs_cpp (massless p p > e+ e-) and the FD/unitary gauge
test_standalone_cpp_fd_output_consistency. The remaining standalone comparison
tests (decay-chain output_consistency, density) sit at the numerical-noise
floor (matrix elements ~0 at the test phase-space point), where a cross-backend
value comparison is not meaningful, so they are intentionally left out.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…failure)

MadSpin's MC-integrated partial-width computation (run_onshell BR path) generates
a width_calculator via a bare 'output', which now defaults to mg7. The mg7
launcher requires lhapdf, so the onshell decay modes failed in CI (e.g.
test_short_madspin_singletop[onshell_decay_chain]) on runners without lhapdf,
while passing locally where lhapdf is present. The legacy (full_decay_chain)
path uses factorized analytic widths and is unaffected, which is why only the
onshell modes broke.

Force 'output madevent' for the width_calculator, mirroring the existing pins
for the production (madspin_comparator) and the decay matrix element
(interface_madspin.py:1391/1395). Verified test_short_madspin_singletop still
passes (228s) -- madevent is the structure this width computation expects.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
When a MadSpin mode fails (or produces no decayed LHE), surface the per-mode
madspin.log on stdout so the CI output shows why -- otherwise only the log path
(on the runner, inaccessible after the job) was reported. Gated by the active
-l logging level: always at DEBUG (even on success), only on failure at INFO,
and never when quieter. Verified the gating (INFO: success=no/fail=yes;
WARNING: never) and the dump formatting in isolation.

This makes the recurring test_short_madspin_singletop[onshell_decay_chain] CI
failure self-diagnosing on the next run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On ubuntu-24 / Python 3.12, numpy>=1.26's f2py uses the meson backend to compile
the Fortran matrix-element wrappers (e.g. all_matrix2py.so for MadSpin/reweight),
which needs the meson and ninja executables. They were absent on the runner, so
the f2py compile failed with FileNotFoundError: 'meson' (surfacing as the
test_short_madspin_singletop[onshell_decay_chain] failure once the MadSpin log
was printed).

Install meson + ninja alongside numpy into the pip-numpy cache; restore-pip-cache
already exposes that dir on PYTHONPATH and its bin/ on PATH, so the executables
are found wherever the cache is restored. Verified 'pip install --target' places
runnable meson/ninja in bin/.

NOTE: requires rebuilding the pip-numpy-ubuntu24 cache (re-run warm_cache with the
cache reset / delete the existing pip-numpy-$ImageOS cache) for this to take
effect.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Replace the 'github.ref_name == 3.x || test_ci' job guards (8 job-level + 1
always()-wrapped) with main/test_ci plus the workflow_dispatch and schedule
event triggers, so the cache-warming jobs actually run on the main branch and
on manual/scheduled invocations.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The W width computation (w+ > all all under loop_sm, tree-level) used a bare
'output', now defaulting to mg7. launch then hit the mg7 launcher
('Can't load lhapdf module' -- a width needs no PDF) and produced no madevent
HTML/results.pkl, so load_result('run_01') returned None and the test errored
with TypeError. Pin to 'output madevent'. Verified passing (18s).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Bare `output <dir>` now defaults to mg7 (ProcessExporterMadMatrix) after
the aloha merge, which produces no Cards/me5_configuration.txt and no
MadEvent launcher. decay_comparator.py then builds a MadEventCmd on that
directory and runs calculate_decay_widths/launch, failing with
FileNotFoundError; test_madevent_ufo_aloha_merged likewise looked for the
Fortran DHELAS ALOHA routines that mg7 never emits.

Pin all five output calls in decay_comparator (has_same_decay,
check_3body, get_2body) and the merged ufo_aloha test to `output madevent`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
push: has no branch filter, so same-repo PR branches are already covered
by the push event; the pull_request run was a duplicate. Add the existing
`github.event_name == 'push' || pull_request.head.repo.fork == true` guard
(already used by 8 jobs) to the remaining 35 jobs so non-fork PRs skip the
redundant run while fork PRs (no push trigger on base repo) still run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Qubitol Qubitol marked this pull request as ready for review June 17, 2026 11:30
@Qubitol Qubitol mentioned this pull request Jun 17, 2026
13 tasks
@Qubitol Qubitol deleted the branch feat-madmatrix June 17, 2026 11:56
@Qubitol Qubitol closed this Jun 17, 2026
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.

6 participants