Skip to content

Commit

Permalink
madgraph5: add newer versions and a pythia8 variant (spack#41128)
Browse files Browse the repository at this point in the history
Co-authored-by: Wouter Deconinck <[email protected]>
Co-authored-by: Bernhard Kaindl <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2024
1 parent 0191e15 commit f25e586
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 17 deletions.
38 changes: 38 additions & 0 deletions var/spack/repos/builtin/packages/madgraph5amc/gcc14.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From b470cfe805e747204a86eedada1d90aae1ebceec Mon Sep 17 00:00:00 2001
From: Joseph C Wang <[email protected]>
Date: Sat, 24 Aug 2024 00:36:46 +0800
Subject: [PATCH] add compile flags for gcc14 compilation

This disables pointer mismatch warnings which are now errors in
gcc14.
---
vendor/StdHEP/mcfio/src/GNUmakefile | 2 +-
vendor/StdHEP/src/stdhep/GNUmakefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/vendor/StdHEP/mcfio/src/GNUmakefile b/vendor/StdHEP/mcfio/src/GNUmakefile
index 591007abe3..14862ba79e 100644
--- a/vendor/StdHEP/mcfio/src/GNUmakefile
+++ b/vendor/StdHEP/mcfio/src/GNUmakefile
@@ -13,7 +13,7 @@ BINDIR = ../../bin
include ../arch_mcfio

FFLAGS += -std=legacy
-CFLAGS += -Wno-implicit-function-declaration
+CFLAGS += -Wno-implicit-function-declaration -Wno-incompatible-pointer-types

FINC = -I.
CINC = -I. -I/usr/include/tirpc
diff --git a/vendor/StdHEP/src/stdhep/GNUmakefile b/vendor/StdHEP/src/stdhep/GNUmakefile
index b1d7591ef0..d0421788c9 100644
--- a/vendor/StdHEP/src/stdhep/GNUmakefile
+++ b/vendor/StdHEP/src/stdhep/GNUmakefile
@@ -8,7 +8,7 @@ STDHEP_DIR = ../..
#this has been added by MZ
FFLAGS+= -fd-lines-as-code -fPIE
FFLAGS += -std=legacy
-CFLAGS += -Wno-implicit-function-declaration
+CFLAGS += -Wno-implicit-function-declaration -Wno-incompatible-pointer-types

SLIB = $(STDHEP_DIR)/lib
SBIN = $(STDHEP_DIR)/bin
78 changes: 61 additions & 17 deletions var/spack/repos/builtin/packages/madgraph5amc/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,42 @@ class Madgraph5amc(MakefilePackage):
event manipulation and analysis."""

homepage = "https://launchpad.net/mg5amcnlo"
url = "https://launchpad.net/mg5amcnlo/2.0/2.7.x/+download/MG5_aMC_v2.7.3.tar.gz"
url = "https://launchpad.net/mg5amcnlo/lts/2.9.x/+download/MG5_aMC_v2.9.20.tar.gz"

tags = ["hep"]

version(
"2.8.1",
sha256="acda34414beba201e529b8c03f87f4893fb3f99ed2956a131d60a387e76c5b8c",
url="https://launchpad.net/mg5amcnlo/2.0/2.8.x/+download/MG5_aMC_v2.8.1.tar.gz",
)
version("2.7.3.py3", sha256="400c26f9b15b07baaad9bd62091ceea785c2d3a59618fdc27cad213816bc7225")
# Launchpad can sometimes be slow to respond
timeout = {"timeout": 60}

with default_args(fetch_options=timeout):
version("3.5.5", sha256="3b4262024cefb8a06082faa9a7ba43484b27a3f2b940a06fbe49c640c5b7ebd7")
version(
"2.9.20",
sha256="09a70e2e8b52e504bcaaa6527d3cec9641b043f5f853f2d11fa3c9970b7efae9",
url="https://launchpad.net/mg5amcnlo/lts/2.9.x/+download/MG5_aMC_v2.9.20.tar.gz",
)
with default_args(deprecated=True):
version(
"2.9.19",
sha256="ec95d40ec8845e57682400ef24a3b769a4d0542e3a849b7c5e10105d0a0f8e61",
url="https://launchpad.net/mg5amcnlo/lts/2.9.x/+download/MG5_aMC_v2.9.19.tar.gz",
)
version(
"2.9.17",
sha256="6781c515ccc2005a953c35dcf9238632b761a937f1832bdfaa5514510b8c5a17",
url="https://launchpad.net/mg5amcnlo/lts/2.9.x/+download/MG5_aMC_v2.9.17.tar.gz",
)
# Older versions have been removed, only the latest LTS versions are available:
version(
"2.8.3.2",
sha256="4077eee75f9255fe627755fe0ac5da5d72f5d5c4f70b6e06e4e564e9c512b215",
url="https://launchpad.net/mg5amcnlo/lts/2.8.x/+download/MG5_aMC_v2.8.3.2.tar.gz",
)
version(
"2.7.3.py3",
sha256="400c26f9b15b07baaad9bd62091ceea785c2d3a59618fdc27cad213816bc7225",
url="https://launchpad.net/mg5amcnlo/lts/2.7.x/+download/MG5_aMC_v2.7.3.py3.tar.gz",
)

variant(
"atlas",
Expand All @@ -35,6 +61,7 @@ class Madgraph5amc(MakefilePackage):
)
variant("ninja", default=False, description="Use external installation" + " of Ninja")
variant("collier", default=False, description="Use external installation" + " of Collier")
variant("pythia8", default=False, description="Use external installation of Pythia8")

conflicts("%gcc@10:", when="@2.7.3")

Expand All @@ -46,15 +73,21 @@ class Madgraph5amc(MakefilePackage):
depends_on("py-six", when="@2.7.3.py3,2.8.0:", type=("build", "run"))

depends_on("[email protected]:", when="@2.7.3.py3", type=("build", "run"))
depends_on("[email protected]:2.8.0,3.7:", when="@2.8.0:", type=("build", "run"))
depends_on("libtirpc")
depends_on("pythia8", when="+pythia8")

patch("array-bounds.patch")
patch("madgraph5amc.patch", level=0)
patch("madgraph5amc-2.7.3.atlas.patch", level=0, when="@2.7.3.py2+atlas")
patch("gcc14.patch", when="@:3.5.5%gcc@14:")
patch("array-bounds.patch", when="@:2.8.1")
patch("madgraph5amc.patch", level=0, when="@:2.9")
patch("madgraph5amc-2.7.3.atlas.patch", level=0, when="@2.7.3.py3+atlas")
patch("madgraph5amc-2.8.0.atlas.patch", level=0, when="@2.8.0+atlas")
patch("madgraph5amc-2.8.0.atlas.patch", level=0, when="@2.8.1+atlas")
# Fix running from CVMFS on AFS, for example on lxplus at CERN
patch(
"https://patch-diff.githubusercontent.com/raw/mg5amcnlo/mg5amcnlo/pull/96.diff?full_index=1",
sha256="ac6644f1d0ef51d9bdb27a1519261f1cf27d075d39faa278fbc2849acbc5575d",
when="@3:3.5",
)

def edit(self, spec, prefix):
def set_parameter(name, value):
Expand Down Expand Up @@ -85,12 +118,6 @@ def build(self, spec, prefix):
with working_dir(join_path("vendor", "CutTools")):
make(parallel=False)

with working_dir(join_path("vendor", "StdHEP")):
for m in ["mcfio/arch_mcfio", "src/stdhep_arch"]:
arch = FileFilter(m)
arch.filter("CC.*=.*", "CC = {0}".format(spack_cc))
make(parallel=False)

if "+atlas" in spec:
if os.path.exists(join_path("bin", "compile.py")):
compile_py = Executable(join_path("bin", "compile.py"))
Expand Down Expand Up @@ -120,3 +147,20 @@ def installfile(filename):
join_path("Template", "LO", "Source", ".make_opts"),
join_path(prefix, "Template", "LO", "Source", "make_opts"),
)

# TODO: Fix for reproducibility, see https://github.com/spack/spack/pull/41128#issuecomment-2305777485
if "+pythia8" in spec:
with open("install-pythia8-interface", "w") as f:
f.write(
f"""set pythia8_path {spec['pythia8'].prefix}
install mg5amc_py8_interface
"""
)
mg5 = Executable(join_path(prefix, "bin", "mg5_aMC"))
mg5("install-pythia8-interface")

def url_for_version(self, version):
major = str(version).split(".")[0]
minor = str(version).split(".")[1]
url = f"https://launchpad.net/mg5amcnlo/{major}.0/{major}.{minor}.x/+download/MG5_aMC_v{version}.tar.gz"
return url

0 comments on commit f25e586

Please sign in to comment.