Skip to content

Commit

Permalink
geopm-runtime: New package (spack#42737)
Browse files Browse the repository at this point in the history
* Add systemd

Signed-off-by: Brad Geltz <[email protected]>

* 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 acbf0d9, PR spack#42222.

Signed-off-by: Brad Geltz <[email protected]>

* util-linux: add v2.39.3

Signed-off-by: Brad Geltz <[email protected]>

* py-natsort: add new versions

Signed-off-by: Brad Geltz <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

* geopm-service: update docstrings

Signed-off-by: Brad Geltz <[email protected]>

* Add py-geopmdpy

Signed-off-by: Brad Geltz <[email protected]>

* Add geopm-runtime recipe

Signed-off-by: Brad Geltz <[email protected]>

---------

Signed-off-by: Brad Geltz <[email protected]>
  • Loading branch information
bgeltz authored Apr 2, 2024
1 parent 7afa949 commit 0e016ba
Show file tree
Hide file tree
Showing 7 changed files with 343 additions and 20 deletions.
143 changes: 143 additions & 0 deletions var/spack/repos/builtin/packages/geopm-runtime/package.py
Original file line number Diff line number Diff line change
@@ -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("[email protected]:", type="build", when="+docs")
depends_on("[email protected]:", type="build", when="+docs")
depends_on("[email protected]:", type="build", when="+docs")

# Other Python dependencies - from scripts/setup.py
depends_on("[email protected]:3", type=("build", "run"))
depends_on("[email protected]:", type="build")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", 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("[email protected]:", 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)
33 changes: 15 additions & 18 deletions var/spack/repos/builtin/packages/geopm-service/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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")

Expand All @@ -78,7 +68,7 @@ class GeopmService(AutotoolsPackage):
# Docs dependencies
depends_on("doxygen", type="build", when="+docs")
depends_on("[email protected]:", 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("[email protected]:", type="build", when="+docs")
depends_on("[email protected]:", type="build", when="+docs")
Expand All @@ -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")
Expand Down Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ class GobjectIntrospection(MesonPackage, AutotoolsPackage):
depends_on("cairo+gobject")
depends_on("[email protected]:", when="@1.78")
depends_on("[email protected]:", when="@1.76")
depends_on("glib@2.72:", when="@1.72")
depends_on("glib@2.58:", when="@1.72")
depends_on("[email protected]:", when="@1.56")
depends_on("[email protected]:", when="@1.49.2:")
depends_on("[email protected]:", when="@1.49.2")
depends_on("[email protected]", when="@1.48.0")

depends_on("libffi")
Expand Down
39 changes: 39 additions & 0 deletions var/spack/repos/builtin/packages/py-geopmdpy/package.py
Original file line number Diff line number Diff line change
@@ -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("[email protected]:", type=("build", "run"))
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", type="run")
depends_on("[email protected]:", 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}'")
2 changes: 2 additions & 0 deletions var/spack/repos/builtin/packages/py-natsort/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading

0 comments on commit 0e016ba

Please sign in to comment.