From 0e016ba6f5fd88b9889b8d7f313935005ba7929a Mon Sep 17 00:00:00 2001 From: Brad Geltz Date: Tue, 2 Apr 2024 08:27:36 -0700 Subject: [PATCH] geopm-runtime: New package (#42737) * Add systemd Signed-off-by: Brad Geltz * gobject-introspection: Correct glib versions - The meson.build requirement that the glib version is >= the gobject-introspective version is not in place until v1.76.1. - Prior to that, the requirement was glib >= 2.58.0. - Bug introduced in acbf0d99c4b, PR #42222. Signed-off-by: Brad Geltz * util-linux: add v2.39.3 Signed-off-by: Brad Geltz * py-natsort: add new versions Signed-off-by: Brad Geltz * geopm-service: default systemd support to true - Make the dependency sticky to force a failure if systemd compilation fails, or force the user to disable the option. Signed-off-by: Brad Geltz * geopm-service: Add initial multi-architecture support - Restrict arch conflicts to 3.0.1 - Disable cpuid at configure time on non-x86_64 platforms. Signed-off-by: Brad Geltz * geopm-service: update docstrings Signed-off-by: Brad Geltz * Add py-geopmdpy Signed-off-by: Brad Geltz * Add geopm-runtime recipe Signed-off-by: Brad Geltz --------- Signed-off-by: Brad Geltz --- .../builtin/packages/geopm-runtime/package.py | 143 ++++++++++++++++++ .../builtin/packages/geopm-service/package.py | 33 ++-- .../packages/gobject-introspection/package.py | 4 +- .../builtin/packages/py-geopmdpy/package.py | 39 +++++ .../builtin/packages/py-natsort/package.py | 2 + .../repos/builtin/packages/systemd/package.py | 141 +++++++++++++++++ .../builtin/packages/util-linux/package.py | 1 + 7 files changed, 343 insertions(+), 20 deletions(-) create mode 100644 var/spack/repos/builtin/packages/geopm-runtime/package.py create mode 100644 var/spack/repos/builtin/packages/py-geopmdpy/package.py create mode 100644 var/spack/repos/builtin/packages/systemd/package.py diff --git a/var/spack/repos/builtin/packages/geopm-runtime/package.py b/var/spack/repos/builtin/packages/geopm-runtime/package.py new file mode 100644 index 00000000000000..99230e1d4c446c --- /dev/null +++ b/var/spack/repos/builtin/packages/geopm-runtime/package.py @@ -0,0 +1,143 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os + +from spack.package import * + + +class GeopmRuntime(AutotoolsPackage): + """The Global Extensible Open Power Manager (GEOPM) Runtime is designed to + enhance energy efficiency of applications through active hardware + configuration.""" + + homepage = "https://geopm.github.io" + git = "https://github.com/geopm/geopm.git" + url = "https://github.com/geopm/geopm/tarball/v3.0.1" + + maintainers("bgeltz", "cmcantalupo") + license("BSD-3-Clause") + tags = ["e4s"] + + version("develop", branch="dev", get_full_repo=True) + version("3.0.1", sha256="32ba1948de58815ee055470dcdea64593d1113a6cad70ce00ab0286c127f8234") + + variant("debug", default=False, description="Enable debug") + variant("docs", default=False, description="Create man pages with Sphinx") + variant("overhead", default=False, description="Track time spent in GEOPM API calls") + variant("beta", default=False, description="Enable beta features") + variant("mpi", default=True, description="Enable MPI dependent components") + variant("fortran", default=True, description="Build fortran interface") + variant("openmp", default=True, description="Build with OpenMP") + variant("ompt", default=True, description="Use OpenMP Tools Interface") + variant("gnu-ld", default=False, description="Assume C compiler uses gnu-ld") + variant("intel-mkl", default=True, description="Build with Intel MKL support") + variant( + "checkprogs", + default=False, + description='Build tests (use with "devbuild" or "install --keep-stage")', + ) + + conflicts("%gcc@:7.2", msg="Requires C++17 support") + conflicts("%clang@:4", msg="Requires C++17 support") + conflicts("%gcc", when="+ompt") + + conflicts("platform=darwin", msg="Darwin is not supported") + conflicts("platform=windows", msg="Windows is not supported") + + conflicts("target=aarch64:", msg="Only available on x86_64", when="@3.0.1") + conflicts("target=ppc64:", msg="Only available on x86_64", when="@3.0.1") + conflicts("target=ppc64le:", msg="Only available on x86_64", when="@3.0.1") + + # Autotools dependencies + depends_on("automake", type="build") + depends_on("libtool", type="build") + depends_on("file") + + # Docs dependencies + depends_on("doxygen", type="build", when="+docs") + depends_on("py-sphinx", type="build", when="+docs") + depends_on("py-sphinx-rtd-theme@1:", type="build", when="+docs") + depends_on("py-sphinxemoji@0.2.0:", type="build", when="+docs") + depends_on("py-sphinx-tabs@3.3.1:", type="build", when="+docs") + depends_on("py-pygments@2.13.0:", type="build", when="+docs") + + # Other Python dependencies - from scripts/setup.py + depends_on("python@3.6:3", type=("build", "run")) + depends_on("py-setuptools@53.0.0:", type="build") + depends_on("py-cffi@1.14.5:", type="run") + depends_on("py-natsort@8.2.0:", type="run") + depends_on("py-numpy@1.19.5:", type="run") + depends_on("py-pandas@1.1.5:", type="run") + depends_on("py-tables@3.7.0:", type="run") + depends_on("py-psutil@5.8.0:", type="run") + depends_on("py-pyyaml@6.0:", type="run") + depends_on("py-docutils@0.18:", type="run", when="+checkprogs") + + # Other dependencies + for ver in ["3.0.1", "develop"]: + depends_on(f"geopm-service@{ver}", type="build", when=f"@{ver}") + depends_on(f"py-geopmdpy@{ver}", type="run", when=f"@{ver}") + depends_on("bash-completion") + depends_on("unzip") + depends_on("mpi@2.2:", when="+mpi") + depends_on("libelf") + depends_on("numactl", type="run", when="+checkprogs") + depends_on("stress-ng", type="run", when="+checkprogs") + + # Intel dependencies + depends_on("intel-oneapi-mkl%oneapi", when="+intel-mkl") + + extends("python") + + @property + def install_targets(self): + target = ["install"] + if "+checkprogs" in self.spec: + target += ["checkprogs"] + return target + + def autoreconf(self, spec, prefix): + bash = which("bash") + if not spec.version.isdevelop(): + # Required to workaround missing VERSION files + # from GitHub generated source tarballs + with open("VERSION_OVERRIDE", "w") as fd: + fd.write(f"{spec.version}") + bash("./autogen.sh") + + def configure_args(self): + args = [ + "--with-bash-completion-dir=" + + join_path(self.spec.prefix, "share", "bash-completion", "completions"), + "--disable-geopmd-local", + f"--with-geopmd={self.spec['geopm-service'].prefix}", + ] + + args += self.enable_or_disable("debug") + args += self.enable_or_disable("docs") + args += self.enable_or_disable("overhead") + args += self.enable_or_disable("beta") + args += self.enable_or_disable("mpi") + args += self.enable_or_disable("fortran") + args += self.enable_or_disable("openmp") + args += self.enable_or_disable("ompt") + args += self.with_or_without("gnu-ld") + + return args + + def setup_run_environment(self, env): + # Required to ensure libgeopm.so + # can be used with LD_PRELOAD + if os.path.isdir(self.prefix.lib64): + lib_dir = self.prefix.lib64 + else: + lib_dir = self.prefix.lib + env.prepend_path("LD_LIBRARY_PATH", lib_dir) + + if "+checkprogs" in self.spec: + env.set("GEOPM_SOURCE", self.stage.source_path) + env.prepend_path("PYTHONPATH", self.stage.source_path) + env.set("GEOPM_INSTALL", self.prefix) diff --git a/var/spack/repos/builtin/packages/geopm-service/package.py b/var/spack/repos/builtin/packages/geopm-service/package.py index 78945ef536e704..0798a0375ef804 100644 --- a/var/spack/repos/builtin/packages/geopm-service/package.py +++ b/var/spack/repos/builtin/packages/geopm-service/package.py @@ -9,14 +9,8 @@ class GeopmService(AutotoolsPackage): - """The Global Extensible Open Power Manager (GEOPM) is a framework for - exploring power and energy optimizations targeting heterogeneous platforms. - The GEOPM package provides many built-in features. A simple use case is - reading hardware counters and setting hardware controls with platform - independent syntax using a command line tool on a particular compute node. - An advanced use case is dynamically coordinating hardware settings across - all compute nodes used by a distributed application is response to the - application's behavior and requests from the resource manager. + """The Global Extensible Open Power Manager (GEOPM) Service provides a + user interface for accessing hardware telemetry and settings securely. Note: GEOPM interfaces with hardware using Model Specific Registers (MSRs). For proper usage make sure MSRs are made available via the msr or @@ -35,11 +29,7 @@ class GeopmService(AutotoolsPackage): variant("debug", default=False, description="Enable debug") variant("docs", default=True, description="Create man pages with Sphinx") - variant( - "systemd", - default=False, - description="Enable use of systemd (systemd development libraries required)", - ) + variant("systemd", default=True, description="Enable use of systemd/DBus") variant("liburing", default=True, description="Enables the use of liburing for batch I/O") variant( "libcap", default=True, description="Enables the use of libcap to do capabilities checks" @@ -64,9 +54,9 @@ class GeopmService(AutotoolsPackage): conflicts("platform=darwin", msg="Darwin is not supported") conflicts("platform=windows", msg="Windows is not supported") - conflicts("target=aarch64:", msg="Only available on x86_64") - conflicts("target=ppc64:", msg="Only available on x86_64") - conflicts("target=ppc64le:", msg="Only available on x86_64") + conflicts("target=aarch64:", msg="Only available on x86_64", when="@3.0.1") + conflicts("target=ppc64:", msg="Only available on x86_64", when="@3.0.1") + conflicts("target=ppc64le:", msg="Only available on x86_64", when="@3.0.1") patch("0001-Support-NVML-via-CUDA-installation.patch", when="+nvml") @@ -78,7 +68,7 @@ class GeopmService(AutotoolsPackage): # Docs dependencies depends_on("doxygen", type="build", when="+docs") depends_on("py-docstring-parser@0.13.0:", type="build", when="+docs") - depends_on("py-sphinx@4.5:", type="build", when="+docs") + depends_on("py-sphinx", type="build", when="+docs") depends_on("py-sphinx-rtd-theme@1:", type="build", when="+docs") depends_on("py-sphinxemoji@0.2.0:", type="build", when="+docs") depends_on("py-sphinx-tabs@3.3.1:", type="build", when="+docs") @@ -95,6 +85,7 @@ class GeopmService(AutotoolsPackage): # Other dependencies depends_on("bash-completion") depends_on("unzip") + depends_on("systemd", when="+systemd") depends_on("libcap", when="+libcap") depends_on("liburing", when="+liburing") depends_on("oneapi-level-zero", when="+levelzero") @@ -132,10 +123,16 @@ def configure_args(self): args += self.enable_or_disable("nvml") if "+nvml" in self.spec: args += [ - "--with-nvml=" + join_path(self.spec["cuda"].prefix, "targets", "x86_64-linux") + "--with-nvml=" + + join_path( + self.spec["cuda"].prefix, "targets", f"{self.spec.target.family}-linux" + ) ] args += self.enable_or_disable("rawmsr") + with when("@develop"): + if self.spec.target.family != "x86_64": + args += ["--disable-cpuid"] return args def setup_run_environment(self, env): diff --git a/var/spack/repos/builtin/packages/gobject-introspection/package.py b/var/spack/repos/builtin/packages/gobject-introspection/package.py index 9a91bcf087fa5c..629a4bde9dba18 100644 --- a/var/spack/repos/builtin/packages/gobject-introspection/package.py +++ b/var/spack/repos/builtin/packages/gobject-introspection/package.py @@ -44,9 +44,9 @@ class GobjectIntrospection(MesonPackage, AutotoolsPackage): depends_on("cairo+gobject") depends_on("glib@2.78:", when="@1.78") depends_on("glib@2.76:", when="@1.76") - depends_on("glib@2.72:", when="@1.72") + depends_on("glib@2.58:", when="@1.72") depends_on("glib@2.56:", when="@1.56") - depends_on("glib@2.49.2:", when="@1.49.2:") + depends_on("glib@2.49.2:", when="@1.49.2") depends_on("glib@2.48.1", when="@1.48.0") depends_on("libffi") diff --git a/var/spack/repos/builtin/packages/py-geopmdpy/package.py b/var/spack/repos/builtin/packages/py-geopmdpy/package.py new file mode 100644 index 00000000000000..e49f50aca17a8e --- /dev/null +++ b/var/spack/repos/builtin/packages/py-geopmdpy/package.py @@ -0,0 +1,39 @@ +# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class PyGeopmdpy(PythonPackage): + """The Global Extensible Open Power Manager (GEOPM) Service provides a + user interface for accessing hardware telemetry and settings securely.""" + + homepage = "https://geopm.github.io" + git = "https://github.com/geopm/geopm.git" + url = "https://github.com/geopm/geopm/tarball/v3.0.1" + + maintainers("bgeltz", "cmcantalupo") + license("BSD-3-Clause") + tags = ["e4s"] + + version("develop", branch="dev") + version("3.0.1", sha256="32ba1948de58815ee055470dcdea64593d1113a6cad70ce00ab0286c127f8234") + + depends_on("py-dasbus@1.6.0:", type=("build", "run")) + depends_on("py-cffi@1.14.5:", type="run") + depends_on("py-psutil@5.8.0:", type="run") + depends_on("py-jsonschema@3.2.0:", type="run") + depends_on("py-pyyaml@6.0:", type="run") + depends_on("py-setuptools@53.0.0:", type="build") + + build_directory = "service" + + @run_before("install") + def populate_version(self): + # @develop builds will have a version of 0.0.0 + if not self.spec.version.isdevelop(): + with working_dir(join_path("service", "geopmdpy")): + with open("version.py", "w") as fd: + fd.write(f"__version__ = '{self.spec.version}'") diff --git a/var/spack/repos/builtin/packages/py-natsort/package.py b/var/spack/repos/builtin/packages/py-natsort/package.py index d360b11b8efa7d..23c8499c556920 100644 --- a/var/spack/repos/builtin/packages/py-natsort/package.py +++ b/var/spack/repos/builtin/packages/py-natsort/package.py @@ -14,6 +14,8 @@ class PyNatsort(PythonPackage): license("MIT") + version("8.4.0", sha256="e42c6730e93382f743e09eb24b8d48034d81d089bd259183a88e2c4190e3db90") + version("8.2.0", sha256="0ce4562913d89a6f413fc68c9937cb0fc32be1268f73ac4b68e2646aeae458c6") version("7.1.1", sha256="ada96d9ca0db0d44b891718ff7baff5ac34cf5b6d9def356c0f7a8ea67ae2113") version("7.1.0", sha256="c3de32c8e5e91cf4f2dd1655b4c167ca4676cc28ce397050fc8d229582a71f0d") version("7.0.1", sha256="1a422a344d089f7a2acba788087ca6253ca47a544bda677721f99516cdfd8668") diff --git a/var/spack/repos/builtin/packages/systemd/package.py b/var/spack/repos/builtin/packages/systemd/package.py new file mode 100644 index 00000000000000..0853facc595dbc --- /dev/null +++ b/var/spack/repos/builtin/packages/systemd/package.py @@ -0,0 +1,141 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import os + +from spack.package import * + + +class Systemd(MesonPackage): + """systemd is a suite of basic building blocks for a Linux system. + It provides a system and service manager that runs as PID 1 and + starts the rest of the system.""" + + homepage = "https://systemd.io/" + url = "https://github.com/systemd/systemd/archive/refs/tags/v255.tar.gz" + license("GPL-2.0-only") + + version("255", sha256="28854ffb2cb5f9e07fcbdbaf1e03a80b3462a12edeef84893ca2f37b22e4491e") + + depends_on("meson@0.60.0:", type="build") + depends_on("ninja", type="build") + depends_on("py-jinja2", type="build") + depends_on("util-linux@2.30:") # libmount + depends_on("gperf") + depends_on("libcap") + depends_on("pkgconfig") + + conflicts("%gcc@:8.4") + conflicts("%clang@:7") + + def meson_args(self): + # Setting prefix is required here because without this the installation + # prefix would be repeated twice because of the required use of DESTDIR + # during the install phase. + # Similarly libdir must be set to prevent the regular prefix path from + # influencing the placement of the installed files. + args = [ + "-Dprefix=/", + "-Dlibdir=/lib", + "-Dlibidn2=disabled", + "-Dopenssl=disabled", + "-Dpcre2=disabled", + "-Dinitrd=false", + "-Dresolve=false", + "-Defi=false", + "-Dtpm=false", + "-Dcreate-log-dirs=false", + "-Dseccomp=disabled", + "-Dselinux=disabled", + "-Dapparmor=disabled", + "-Dsmack=false", + "-Dpolkit=disabled", + "-Dima=false", + "-Dacl=disabled", + "-Daudit=disabled", + "-Dblkid=disabled", + "-Dfdisk=disabled", + "-Dkmod=false", + "-Dpam=disabled", + "-Dpasswdqc=disabled", + "-Dpwquality=disabled", + "-Dmicrohttpd=disabled", + "-Dlibcryptsetup=disabled", + "-Dlibcurl=disabled", + "-Dlibiptc=disabled", + "-Dqrencode=disabled", + "-Dgcrypt=disabled", + "-Dgnutls=disabled", + "-Dp11kit=disabled", + "-Dlibfido2=disabled", + "-Dtpm2=disabled", + "-Delfutils=disabled", + "-Dzlib=disabled", + "-Dbzip2=disabled", + "-Dxz=disabled", + "-Dlz4=disabled", + "-Dzstd=disabled", + "-Dxkbcommon=disabled", + "-Dbootloader=disabled", + "-Dnscd=false", # support for... + "-Dutmp=false", + "-Dhibernate=false", + "-Dldconfig=false", + "-Denvironment-d=false", + "-Dbinfmt=false", + "-Dremote=disabled", + "-Dfirstboot=false", + "-Drandomseed=false", + "-Dbacklight=false", + "-Dvconsole=false", + "-Dvmspawn=disabled", + "-Dquotacheck=false", + "-Dsysusers=false", + "-Dstoragetm=false", + "-Dtmpfiles=false", + "-Dimportd=disabled", + "-Dhwdb=false", + "-Drfkill=false", + "-Dgshadow=false", + "-Dkmod=disabled", + "-Dxenctrl=disabled", + "-Drepart=disabled", # install the... + "-Dsysupdate=disabled", + "-Dcoredump=false", + "-Dpstore=false", + "-Doomd=false", + "-Dlogind=false", + "-Dhostnamed=false", + "-Dlocaled=false", + "-Dmachined=false", + "-Dportabled=false", + "-Dsysext=false", + "-Duserdb=false", + "-Dhomed=disabled", + "-Dnetworkd=false", + "-Dtimedated=false", + "-Dtimesyncd=false", + "-Dxdg-autostart=false", + "-Ddefault-network=false", # install... + "-Dnss-myhostname=false", + "-Dnss-mymachines=disabled", + "-Dnss-resolve=disabled", + "-Dnss-systemd=false", + "-Dhtml=disabled", + "-Dtranslations=false", + "-Dinstall-sysconfdir=false", + "-Dkernel-install=false", + "-Dukify=disabled", + "-Danalyze=false", + ] + + return args + + def install(self, spec, prefix): + # DESTDIR is required because without it the install phase will attempt + # to install files in the root file system by default. + os.environ["DESTDIR"] = prefix + with working_dir(self.build_directory): + ninja("install") diff --git a/var/spack/repos/builtin/packages/util-linux/package.py b/var/spack/repos/builtin/packages/util-linux/package.py index 72529d2a356ab5..28b3bdebf7dddc 100644 --- a/var/spack/repos/builtin/packages/util-linux/package.py +++ b/var/spack/repos/builtin/packages/util-linux/package.py @@ -18,6 +18,7 @@ class UtilLinux(AutotoolsPackage): license("GPL-2.0-only") + version("2.39.3", sha256="40ea07584d56c310455471afa92c119ec259776a561af7159cc802344c2c370d") version("2.39.1", sha256="d7c8a58eb2c7248a32754eb3a3b6772e368b984d9907ada834c2cf3e13024270") version("2.38.1", sha256="0820eb8eea90408047e3715424bc6be771417047f683950fecb4bdd2e2cbbc6e") version("2.38", sha256="c31d4e54f30b56b0f7ec8b342658c07de81378f2c067941c2b886da356f8ad42")