summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-06-26 06:12:02 +0200
committerGitHub <noreply@github.com>2024-06-26 06:12:02 +0200
commite6a8eba72dc46c3089ec3383e395749290916721 (patch)
tree6eb19c33a282be3735fd77e6b18e8990c3cb05c6 /var
parent4d604c8c9f12e41a2fdb0292e40b35e19c64f3a5 (diff)
downloadspack-e6a8eba72dc46c3089ec3383e395749290916721.tar.gz
spack-e6a8eba72dc46c3089ec3383e395749290916721.tar.bz2
spack-e6a8eba72dc46c3089ec3383e395749290916721.tar.xz
spack-e6a8eba72dc46c3089ec3383e395749290916721.zip
eztrace: multiple build systems (#44855)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/eztrace/package.py147
1 files changed, 72 insertions, 75 deletions
diff --git a/var/spack/repos/builtin/packages/eztrace/package.py b/var/spack/repos/builtin/packages/eztrace/package.py
index 2a119e960e..b600ac6ffb 100644
--- a/var/spack/repos/builtin/packages/eztrace/package.py
+++ b/var/spack/repos/builtin/packages/eztrace/package.py
@@ -3,17 +3,17 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+from spack.build_systems import autotools, cmake
from spack.package import *
-class Eztrace(Package):
- """EZTrace is a tool to automatically generate execution traces
- of HPC applications."""
+class Eztrace(CMakePackage, AutotoolsPackage, CudaPackage):
+ """EZTrace is a tool to automatically generate execution traces of HPC applications."""
homepage = "https://gitlab.com/eztrace"
- maintainers("trahay")
git = "https://gitlab.com/eztrace/eztrace.git"
+ maintainers("trahay")
license("CECILL-B")
version("master", branch="master")
@@ -22,80 +22,46 @@ class Eztrace(Package):
version("1.1-13", sha256="6144d04fb62b3ccad41af0268cd921161f168d0cca3f6c210c448bb0b07be7e0")
version("1.1-10", sha256="63d1af2db38b04efa817614574f381e7536e12db06a2c75375d1795adda3d1d8")
- # dependencies for eztrace 1.x and 2.x
+ variant("starpu", default=False, description="Enable StarPU support", when="@2.1:")
+ variant("netcdf", default=False, description="Enable NetCDF support", when="@2.1:")
+ variant("pnetcdf", default=False, description="Enable PNetCDF support", when="@2.1:")
+
+ build_system(
+ conditional("cmake", when="@2:"), conditional("autotools", when="@:1"), default="cmake"
+ )
+
depends_on("mpi")
depends_on("opari2")
depends_on("binutils")
+ depends_on("otf2", when="@2:")
- # eztrace 1.x dependencies
- depends_on("autoconf@2.71", type="build", when="@:1")
- depends_on("automake", type="build", when="@:1")
- depends_on("libtool", type="build", when="@:1")
- # Does not work on Darwin due to MAP_POPULATE
- conflicts("platform=darwin", when="@:1")
+ with when("build_system=autotools"):
+ depends_on("autoconf", type="build")
+ depends_on("automake", type="build")
+ depends_on("libtool", type="build")
- # eztrace 2.x dependencies
- depends_on("cmake@3.1:", type="build", when="@2.0:")
- depends_on("otf2", when="@2.0:")
+ with when("build_system=cmake"):
+ depends_on("cmake@3.1:", type="build")
- variant("starpu", default=False, description="Enable StarPU support", when="@2.1:")
- depends_on("starpu", when="@2.1:+starpu")
- variant("cuda", default=False, description="Enable CUDA support", when="@2.1:")
- depends_on("cuda", when="@2.1:+cuda")
- variant("netcdf", default=False, description="Enable NetCDF support", when="@2.1:")
- depends_on("netcdf-c", when="@2.1:+netcdf")
- variant("pnetcdf", default=False, description="Enable PNetCDF support", when="@2.1:")
- depends_on("parallel-netcdf", when="@2.1:+pnetcdf")
+ depends_on("starpu", when="+starpu")
+ depends_on("cuda", when="+cuda")
+ depends_on("netcdf-c", when="+netcdf")
+ depends_on("parallel-netcdf", when="+pnetcdf")
- def url_for_version(self, version):
- url = "https://gitlab.com/eztrace/eztrace/-/archive/{0}/eztrace-{1}.tar.gz"
- return url.format(version, version)
+ patch(
+ "https://gitlab.com/eztrace/eztrace/-/commit/3aafa74b12bc2c7e0687f2dbcfc35a699487eb10.diff",
+ sha256="45321b0fd15db84840280c34a91ab877d0ceec6eb825f699f08a7bd135be3d79",
+ when="@:1",
+ )
- @when("@2.0:")
- def install(self, spec, prefix):
- # Since eztrace 2.0, the build system uses CMake
- spec = self.spec
- args = [
- "-DCMAKE_INSTALL_PREFIX=$prefix",
- "-DEZTRACE_ENABLE_MEMORY=ON",
- "-DEZTRACE_ENABLE_MPI=ON",
- "-DEZTRACE_ENABLE_OPENMP=ON",
- "-DEZTRACE_ENABLE_POSIXIO=ON",
- "-DEZTRACE_ENABLE_PTHREAD=ON",
- "-DOTF2_INCLUDE_PATH=%s" % spec["otf2"].prefix.include,
- "-DOTF2_LIBRARY_PATH=%s" % spec["otf2"].libs,
- ]
+ # Does not work on Darwin due to MAP_POPULATE
+ conflicts("platform=darwin", when="@:1")
- if spec.satisfies("@2.1:"):
- if spec.satisfies("%llvm-openmp-ompt"):
- args.extend(["-DEZTRACE_ENABLE_OMPT=ON"])
- if "+starpu" in spec:
- args.extend(["-DEZTRACE_ENABLE_STARPU=ON"])
- if "+cuda" in spec:
- args.extend(["-DEZTRACE_ENABLE_CUDA=ON"])
- if "+netcdf" in spec:
- args.extend(["-DEZTRACE_ENABLE_NETCDF=ON"])
- if "+pnetcdf" in spec:
- args.extend(["-DEZTRACE_ENABLE_PNETCDF=ON"])
-
- args.extend(std_cmake_args)
-
- with working_dir("spack-build", create=True):
- cmake("..", *args)
- make()
- make("install")
-
- # Until eztrace 2.0, the build system uses autoconf
- @when("@:1")
- def install(self, spec, prefix):
- if self.spec.satisfies("%fj"):
- env.set("LDFLAGS", "--linkfortran")
- self.patch()
- which("bash")("bootstrap")
- configure("--prefix=" + prefix, "--with-mpi={0}".format(self.spec["mpi"].prefix))
- self.fix_libtool()
- make()
- make("install")
+ # CUDA support from 2.1
+ conflicts("+cuda", when="@:2.0")
+
+ def url_for_version(self, version):
+ return f"https://gitlab.com/eztrace/eztrace/-/archive/{version}/eztrace-{version}.tar.gz"
@when("@:1")
def patch(self):
@@ -106,9 +72,40 @@ class Eztrace(Package):
string=True,
)
- @when("@:1")
- def fix_libtool(self):
- if self.spec.satisfies("%fj"):
- libtools = ["extlib/gtg/libtool", "extlib/opari2/build-frontend/libtool"]
- for f in libtools:
- filter_file('wl=""', 'wl="-Wl,"', f, string=True)
+
+class CMakeBuilder(cmake.CMakeBuilder):
+ def cmake_args(self):
+ spec = self.spec
+ args = [
+ self.define("EZTRACE_ENABLE_MEMORY", True),
+ self.define("EZTRACE_ENABLE_MPI", True),
+ self.define("EZTRACE_ENABLE_OPENMP", True),
+ self.define("EZTRACE_ENABLE_POSIXIO", True),
+ self.define("EZTRACE_ENABLE_PTHREAD", True),
+ self.define("OTF2_INCLUDE_PATH", spec["otf2"].prefix.include),
+ self.define("OTF2_LIBRARY_PATH", spec["otf2"].libs),
+ ]
+
+ if spec.satisfies("@2.1: %llvm-openmp-ompt"):
+ args.append(self.define("EZTRACE_ENABLE_OMPT", True))
+ if "+starpu" in spec:
+ args.append(self.define("EZTRACE_ENABLE_STARPU", True))
+ if "+cuda" in spec:
+ args.append(self.define("EZTRACE_ENABLE_CUDA", True))
+ if "+netcdf" in spec:
+ args.append(self.define("EZTRACE_ENABLE_NETCDF", True))
+ if "+pnetcdf" in spec:
+ args.append(self.define("EZTRACE_ENABLE_PNETCDF", True))
+
+ return args
+
+
+class AutotoolsBuilder(autotools.AutotoolsBuilder):
+ def setup_build_environment(self, env):
+ env.set("LDFLAGS", "--linkfortran")
+
+ def autoreconf(self, pkg, spec, prefix):
+ Executable("/bin/sh")("./bootstrap")
+
+ def configure_args(self):
+ return [f"--with-mpi={self.spec['mpi'].prefix}"]