FFTX: replace extends with variants (#39701)

The spiral-software package had a number of extensions, but does not
work unless they actually exist in the spiral software prefix (creating
a view is not sufficient). With the removal of "spack activate"
(different from "spack env activate"), a new approach is needed to
support optional components of `spiral-software` . This commit updates
the spiral-software package to copy the dependency installations into
its own prefix.

This commit also adds versions for `fftx` and `spiral-software`, as
well as an optional `spiral-software-jit` package.
This commit is contained in:
Patrick Broderick 2023-09-06 16:35:33 -04:00 committed by GitHub
parent 627c2d3bf6
commit 57cd822fb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 125 additions and 55 deletions

View file

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os.path
from spack.package import *
@ -11,20 +13,22 @@ class Fftx(CMakePackage, CudaPackage, ROCmPackage):
package for executing the Fast Fourier Transform as well as higher-level
operations composed of linear operations combined with DFT transforms."""
homepage = "https://spiral.net"
url = "https://github.com/spiral-software/fftx/archive/refs/tags/1.0.3.tar.gz"
homepage = "https://spiralgen.com"
url = "https://github.com/spiral-software/fftx/archive/refs/tags/1.1.2.tar.gz"
git = "https://github.com/spiral-software/fftx.git"
maintainers("spiralgen")
version("develop", branch="develop")
version("main", branch="main")
version("1.1.2", sha256="b2c4a7791305481af9e1bd358c1215efa4506c91c943cddca3780a1ccbc27810")
version("1.1.1", sha256="5cbca66ef09eca02ee8f336f58eb45cfac69cfb29cd6eb945852ad74085d8a60")
version("1.1.0", sha256="a6f95605abc11460bbf51839727a456a31488e27e12a970fc29a1b8c42f4e3b5")
version("1.0.3", sha256="b5ff275facce4a2fbabd0aecc65dd55b744794f2e07cd8cfa91363001c664896")
depends_on("spiral-software")
depends_on("spiral-package-fftx")
depends_on("spiral-package-simt")
# depends_on('spiral-package-mpi')
depends_on("spiral-software+fftx+simt+jit+mpi")
# depend only on spiral-software, but spiral-software must be installed with variants:
# +fftx +simt +mpi +jit
conflicts("+rocm", when="+cuda", msg="FFTX only supports one GPU backend at a time")
@ -39,41 +43,37 @@ def create_lib_source_code(self):
backend = "HIP"
self.build_config = "-D_codegen=%s" % backend
# From directory examples/library run the build-lib-code.sh script
with working_dir(join_path(self.stage.source_path, "src", "library")):
# From the root directory run the config-fftx-libs.sh script
with working_dir(self.stage.source_path):
bash = which("bash")
bash("./build-lib-code.sh", backend)
bash("./config-fftx-libs.sh", backend)
def cmake_args(self):
spec = self.spec
args = ["-DSPIRAL_HOME:STRING={0}".format(spec["spiral-software"].prefix)]
args.append("-DCMAKE_INSTALL_PREFIX:PATH={0}".format(self.stage.source_path))
args.append("-DCMAKE_INSTALL_PREFIX:PATH={0}".format(self.prefix))
if "+rocm" in spec:
args.append("-DCMAKE_CXX_COMPILER={0}".format(self.spec["hip"].hipcc))
args.append(self.build_config)
print("Args = " + str(args))
return args
@property
def build_targets(self):
return ["-j1", "install"]
return ["install"]
def install(self, spec, prefix):
mkdirp(prefix.bin)
mkdirp(prefix.CMakeIncludes)
mkdirp(prefix.examples)
mkdirp(prefix.include)
mkdirp(prefix.lib)
with working_dir(self.stage.source_path):
files = ("License.txt", "README.md", "ReleaseNotes.md")
files = ("License.txt", "README.md", "ReleaseNotes.md", "supercomputer-README.md")
for fil in files:
install(fil, prefix)
mkdirp(prefix.cache_jit_files)
with working_dir(self.stage.source_path):
install_tree("bin", prefix.bin)
install_tree("CMakeIncludes", prefix.CMakeIncludes)
install_tree("examples", prefix.examples)
install_tree("include", prefix.include)
install_tree("lib", prefix.lib)
dir = join_path(self.stage.source_path, "cache_jit_files")
if os.path.isdir(dir):
install_tree("cache_jit_files", prefix.cache_jit_files)
def setup_dependent_build_environment(self, env, dependent_spec):
env.set("FFTX_HOME", self.prefix)

View file

@ -12,22 +12,22 @@ class SpiralPackageFftx(Package):
Transform as well as higher-level operations composed of linear operations
combined with DFT transforms."""
homepage = "https://spiral.net"
url = "https://github.com/spiral-software/spiral-package-fftx/archive/refs/tags/1.0.0.tar.gz"
homepage = "https://spiralgen.com"
url = "https://github.com/spiral-software/spiral-package-fftx/archive/refs/tags/1.2.2.tar.gz"
git = "https://github.com/spiral-software/spiral-package-fftx.git"
maintainers("spiralgen")
extends("spiral-software")
# Although this package 'extends("spiral-software")' don't declare it as
# such. If this package is required spiral-software should be installed
# with the +fftx variant active
version("develop", branch="develop")
version("main", branch="main")
version("1.2.2", sha256="18dacc3f974c4bd58295be2ea61f8ae0aada9a239f27b93d7806df564612cf22")
version("1.2.1", sha256="3f15aa5949c1b09eb59257cf1c5f6fcddc6e46f77ae9d5fce8acd8b9f99ce941")
version("1.1.1", sha256="99ec7fab9274d378524b4933917fae23f9590255518c7a124cb46bd5e8d9af37")
version("1.1.0", sha256="979d7e59fc39e7e5423bce64628cea467079667d75ce885febee7c42fa7164aa")
version("1.0.0", sha256="9ed352049fcaab31a1a898149d16438c95a1656a2d24df6dee14e3b61efacb5c")
# FFTX package is an extension for Spiral (spec: spiral-software). Spiral finds
# extensions in the "namespaces/packages" folder. Install the tree in a similarly
# named folder so that when activated it'll get symlinked to the correct place.
# FFTX package is an extension for Spiral (spec: spiral-software).
def install(self, spec, prefix):
spiral_pkgs = join_path(prefix, "namespaces", "packages", "fftx")

View file

@ -10,20 +10,19 @@ class SpiralPackageHcol(Package):
"""This is the SPIRAL package for the Hybrid Control Operator Language
(HCOL)."""
homepage = "https://spiral.net"
homepage = "https://spiralgen.com"
url = "https://github.com/spiral-software/spiral-package-hcol/archive/refs/tags/1.0.0.tar.gz"
git = "https://github.com/spiral-software/spiral-package-hcol.git"
maintainers("spiralgen")
extends("spiral-software")
# Although this package 'extends("spiral-software")' don't declare it as
# such. If this package is required spiral-software should be installed
# with the +hcol variant active
version("master", branch="master")
version("1.0.0", sha256="18ae6f0a090de03723612a6c91ca17cf62971129540936d8c2738bd8f807a511")
# HCOL package is an extension for Spiral (spec: spiral-software). Extensions
# packages for Spiral are intended to be installed in the spiral-software prefix,
# in the "namespaces/packages" folder. Install the tree in that folder under the
# name 'hcol'.
# HCOL package is an extension for Spiral (spec: spiral-software).
def install(self, spec, prefix):
spiral_pkgs = join_path(prefix, "namespaces", "packages", "hcol")

View file

@ -0,0 +1,31 @@
# 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)
from spack.package import *
class SpiralPackageJit(Package):
"""This is the SPIRAL package for Just-In-Time (JIT) or Real-Time
Compilation (RTC)."""
homepage = "https://spiralgen.com"
url = "https://github.com/spiral-software/spiral-package-jit/archive/refs/tags/1.0.2.tar.gz"
git = "https://github.com/spiral-software/spiral-package-jit.git"
maintainers("spiralgen")
# Although this package 'extends("spiral-software")' don't declare it as
# such. If this package is required spiral-software should be installed
# with the +jit variant active
version("develop", branch="develop")
version("main", branch="main")
version("1.0.2", sha256="d7fac0493ac406a8b1874491223c3a9a1c6727ea1aa39de7ef4694c59aac9d26")
version("1.0.1", sha256="acf22db04e705276f06642d7f2ebf161f6c347f93bb1bdd6e3ddcfc4b7be5707")
# JIT package is an extension for Spiral (spec: spiral-software).
def install(self, spec, prefix):
spiral_pkgs = join_path(prefix, "namespaces", "packages", "jit")
install_tree(".", spiral_pkgs)

View file

@ -9,20 +9,21 @@
class SpiralPackageMpi(Package):
"""This is the SPIRAL package for MPI."""
homepage = "https://spiral.net"
url = "https://github.com/spiral-software/spiral-package-mpi/archive/refs/tags/1.0.0.tar.gz"
homepage = "https://spiralgen.com"
url = "https://github.com/spiral-software/spiral-package-mpi/archive/refs/tags/1.1.0.tar.gz"
git = "https://github.com/spiral-software/spiral-package-mpi.git"
maintainers("spiralgen")
extends("spiral-software")
# Although this package 'extends("spiral-software")' don't declare it as
# such. If this package is required spiral-software should be installed
# with the +mpi variant active
version("develop", branch="develop")
version("main", branch="main")
version("1.1.0", sha256="baf3c9dac7fee330e4bb4adbd24cc7e55f27fc27417644c0b216124f9052f1f5")
version("1.0.0", sha256="64896a82aacce9cc8abe88b921e09ba7a5fceb8262e490f60a7088583c2c2151")
# MPI package is an extension for Spiral (spec: spiral-software). Spiral finds
# extensions in the "namespaces/packages" folder. Install the tree in a similarly
# named folder so that when activated it'll get symlinked to the correct place.
# MPI package is an extension for Spiral (spec: spiral-software).
def install(self, spec, prefix):
spiral_pkgs = join_path(prefix, "namespaces", "packages", "mpi")

View file

@ -10,21 +10,21 @@ class SpiralPackageSimt(Package):
"""This is the SPIRAL package for SIMT: SIMT, single instruction multiple
threads, is used to generate code for GPUs and multi-threading aplications."""
homepage = "https://spiral.net"
url = "https://github.com/spiral-software/spiral-package-simt/archive/refs/tags/1.0.0.tar.gz"
homepage = "https://spiralgen.com"
url = "https://github.com/spiral-software/spiral-package-simt/archive/refs/tags/1.1.0.tar.gz"
git = "https://github.com/spiral-software/spiral-package-simt.git"
maintainers("spiralgen")
extends("spiral-software")
# Although this package 'extends("spiral-software")' don't declare it as
# such. If this package is required spiral-software should be installed
# with the +simt variant active
version("develop", branch="develop")
version("main", branch="main")
version("1.1.0", sha256="4d6a5e586889b9e000968c99f3068ba86a12cc389665c6deadc4734117ef7a95")
version("1.0.0", sha256="888ca01aa8fd5df80d6ae1bd64eb1b1e70240b6a36bc3437eb48f5a4b59c2d07")
# SIMT package is an extension for Spiral (spec: spiral-software). Spiral finds
# extensions in the "namespaces/packages" folder. Install the tree in a similarly
# named folder so that when activated it'll get symlinked to the correct place.
# SIMT package is an extension for Spiral (spec: spiral-software).
def install(self, spec, prefix):
spiral_pkgs = join_path(prefix, "namespaces", "packages", "simt")

View file

@ -11,31 +11,66 @@ class SpiralSoftware(CMakePackage):
mathematical functions that produces very high performance code for a wide
spectrum of hardware platforms."""
homepage = "https://spiral.net"
url = "https://github.com/spiral-software/spiral-software/archive/refs/tags/8.4.0.tar.gz"
homepage = "https://spiralgen.com"
url = "https://github.com/spiral-software/spiral-software/archive/refs/tags/8.5.0.tar.gz"
git = "https://github.com/spiral-software/spiral-software.git"
maintainers("spiralgen")
version("develop", branch="develop")
version("master", branch="master")
version("8.5.0", sha256="829345b8ca3ab0069a1a6e230f60ab03257060a8f05c021cee022e294eef592d")
version("8.4.0", sha256="d0c58de65c678130eeee6b8b8b48061bbe463468990f66d9b452225ce46dee19")
version("8.3.0", sha256="41cf0e7f14f9497e98353baa1ef4ca6204ce5ca525db8093f5bb44e89992abdf")
version("8.2.1", sha256="78d7bb1c22a5b2d216eac7b6ddedd20b601ba40227e64f743cbb54d4e5a7794d")
version("8.2.0", sha256="983f38d270ae2cb753c88cbce3f412e307c773807ad381acedeb9275afc0be32")
extendable = True
# No dependencies.
# No dependencies. Spiral pacakges are listed here as variants. If a
# variant (i.e., spiral-package) is enabled then spiral-software depends
# on the package, so dependencies may be added during the install process.
variant("fftx", default=False, description="Install Spiral package FFTX.")
variant(
"simt",
default=False,
description="Install Spiral package for Single Instruction, Multiple Threads"
" (SIMT) to generate code for GPUs.",
)
variant(
"mpi",
default=False,
description="Install Spiral package for Message Passing Interface (MPI).",
)
variant(
"jit",
default=False,
description="Install Spiral supporting Just-In-Time (aka RTC) Compilation.",
)
variant(
"hcol",
default=False,
description="Install Spiral package for the Hybrid Control Operator Language (HCOL).",
)
# Dependencies
for pkg in ["fftx", "simt", "mpi", "jit", "hcol"]:
depends_on(f"spiral-package-{pkg}", when=f"+{pkg}")
def build(self, spec, prefix):
with working_dir(self.build_directory):
make("all")
make("install")
def spiral_package_install(self, spec, prefix, pkg):
pkg_name = "spiral-package-" + pkg
pkg_prefix = spec[pkg_name].prefix
dest = join_path(prefix, "namespaces", "packages", pkg)
src = join_path(pkg_prefix, "namespaces", "packages", pkg)
install_tree(src, dest)
def install(self, spec, prefix):
with working_dir(self.stage.source_path):
files = ("LICENSE", "README.md", "ReleaseNotes.md")
files = ("LICENSE", "README.md", "ReleaseNotes.md", "Contributing.md")
for fil in files:
install(fil, prefix)
@ -61,6 +96,10 @@ def install(self, spec, prefix):
install_tree("grp", prefix.gap.grp)
install_tree("bin", prefix.gap.bin)
for pkg in ["fftx", "simt", "mpi", "jit", "hcol"]:
if f"+{pkg}" in spec:
self.spiral_package_install(spec, prefix, pkg)
def setup_dependent_build_environment(self, env, dependent_spec):
env.set("SPIRAL_HOME", self.prefix)