Skip to content

Commit

Permalink
Creation of Beatnik package and associated updates to silo and cabana…
Browse files Browse the repository at this point in the history
… spack package (spack#40382)

* Added initial package for building Beatnik with spack

* Fixed github ID for Jason as a maintainer.

* Major revision of beatnik spack package to properly support GPU spack builds with CUDA (and ROCm, though that it untested)

* Marked that beatnik 1.0 will require cabana 0.6.0. We will wait for the cabana 0.6.0 release before we release beatnik

* Update to beatnik package spec to compile with hipcc when +rocm

* Updated spack package for cabana for version 0.6.0 and appropriate heffte dependency

* Updated beatnik package to require cabana 0.6.0

* More updates to cabana and beatnik to build with cabana 0.6.0

* Finish removing BLT dependence from beatnik

* More updates to beatnik package for compiling on cray systems

* Updated beatnik package for new cabana package

* Changes to silo package for new silo version

* Fixed version specs for heffte to be able to concretize and build

* Fixed spack style issues for beatnik and silo packages

* More spack formatting fixes to beatnik and silo

* Patrick adopting silo package as maintainer for now

* Should address final style changes to beatnik package spec

* Yet more style fixes.

* Perhaps this is the final style fixes? :)

* Minor fix to cabana package on required versions
  • Loading branch information
patrickb314 authored Oct 17, 2023
1 parent 2913cd9 commit 7cc17f2
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 10 deletions.
90 changes: 90 additions & 0 deletions var/spack/repos/builtin/packages/beatnik/package.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# 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 Beatnik(CMakePackage, CudaPackage, ROCmPackage):
"""Fluid interface model solver based on Pandya and Shkoller's Z-Model formulation."""

homepage = "https://github.com/CUP-ECS/beatnik"
git = "https://github.com/CUP-ECS/beatnik.git"

maintainers("patrickb314", "JStewart28")

# Add proper versions and checksums here. Will add 1.0 when a proper SHA is available
# version("1.0", sha256="XXX")
version("develop", branch="develop")
version("main", branch="main")

# Variants are primarily backends to build on GPU systems and pass the right
# informtion to the packages we depend on
variant("cuda", default=False, description="Use CUDA support from subpackages")
variant("openmp", default=False, description="Use OpenMP support from subpackages")

# Dependencies for all Beatnik versions
depends_on("mpi")
depends_on("mpi +cuda", when="+cuda")
depends_on("mpi +rocm", when="+rocm")

# Kokkos dependencies
depends_on("kokkos @4:")
depends_on("kokkos +cuda +cuda_lambda +cuda_constexpr", when="+cuda")
depends_on("kokkos +rocm", when="+rocm")
depends_on("kokkos +wrapper", when="%gcc+cuda")

# Cabana dependencies
depends_on("cabana @0.6.0 +grid +heffte +silo +hdf5 +mpi")
depends_on("cabana +cuda", when="+cuda")
depends_on("cabana +rocm", when="+rocm")

# Silo dependencies
depends_on("silo @4.11:")
depends_on("silo @4.11.1:", when="%cce") # Eariler silo versions have trouble cce

# Heffte dependencies - We always require FFTW so that there's a host
# backend even when we're compiling for GPUs
depends_on("heffte +fftw")
depends_on("heffte +cuda", when="+cuda")
depends_on("heffte +rocm", when="+rocm")

# If we're using CUDA or ROCM, require MPIs be GPU-aware
conflicts("mpich ~cuda", when="+cuda")
conflicts("mpich ~rocm", when="+rocm")
conflicts("openmpi ~cuda", when="+cuda")
conflicts("^intel-mpi") # Heffte won't build with intel MPI because of needed C++ MPI support

# Propagate CUDA and AMD GPU targets to cabana
for cuda_arch in CudaPackage.cuda_arch_values:
depends_on("cabana cuda_arch=%s" % cuda_arch, when="+cuda cuda_arch=%s" % cuda_arch)
for amdgpu_value in ROCmPackage.amdgpu_targets:
depends_on(
"cabana +rocm amdgpu_target=%s" % amdgpu_value,
when="+rocm amdgpu_target=%s" % amdgpu_value,
)

# CMake specific build functions
def cmake_args(self):
args = []

# Use hipcc as the c compiler if we are compiling for rocm. Doing it this way
# keeps the wrapper insted of changeing CMAKE_CXX_COMPILER keeps the spack wrapper
# and the rpaths it sets for us from the underlying spec.
if "+rocm" in self.spec:
env["SPACK_CXX"] = self.spec["hip"].hipcc

# If we're building with cray mpich, we need to make sure we get the GTL library for
# gpu-aware MPI, since cabana and beatnik require it
if self.spec.satisfies("+rocm ^cray-mpich"):
gtl_dir = join_path(self.spec["cray-mpich"].prefix, "..", "..", "..", "gtl", "lib")
args.append(
"-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath={0} -L{0} -lmpi_gtl_hsa".format(gtl_dir)
)
elif self.spec.satisfies("+cuda ^cray-mpich"):
gtl_dir = join_path(self.spec["cray-mpich"].prefix, "..", "..", "..", "gtl", "lib")
args.append(
"-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath={0} -L{0} -lmpi_gtl_cuda".format(gtl_dir)
)
return args
25 changes: 21 additions & 4 deletions var/spack/repos/builtin/packages/cabana/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Cabana(CMakePackage, CudaPackage, ROCmPackage):

homepage = "https://github.com/ECP-copa/Cabana"
git = "https://github.com/ECP-copa/Cabana.git"
url = "https://github.com/ECP-copa/Cabana/archive/0.5.0.tar.gz"
url = "https://github.com/ECP-copa/Cabana/archive/0.6.0.tar.gz"

maintainers("junghans", "streeve", "sslattery")

Expand Down Expand Up @@ -47,6 +47,7 @@ class Cabana(CMakePackage, CudaPackage, ROCmPackage):

depends_on("[email protected]:", type="build", when="@:0.4.0")
depends_on("[email protected]:", type="build", when="@0.5.0:")

depends_on("googletest", type="test", when="+testing")
_versions = {":0.2": "-legacy", "0.3:": "@3.1:", "0.4:": "@3.2:", "0.6:": "@3.7:"}
for _version in _versions:
Expand All @@ -63,34 +64,50 @@ class Cabana(CMakePackage, CudaPackage, ROCmPackage):
_kk_spec = "kokkos{0}+{1}".format(_kk_version, _backend)
depends_on(_kk_spec, when="@{0}+{1}".format(_version, _backend))

# Propagate cuda architectures down to Kokkos and optional submodules
for arch in CudaPackage.cuda_arch_values:
cuda_dep = "+cuda cuda_arch={0}".format(arch)
depends_on("kokkos {0}".format(cuda_dep), when=cuda_dep)
depends_on("heffte {0}".format(cuda_dep), when="+heffte {0}".format(cuda_dep))
depends_on("arborx {0}".format(cuda_dep), when="+arborx {0}".format(cuda_dep))
depends_on("hypre {0}".format(cuda_dep), when="+hypre {0}".format(cuda_dep))

for arch in ROCmPackage.amdgpu_targets:
rocm_dep = "+rocm amdgpu_target={0}".format(arch)
depends_on("kokkos {0}".format(rocm_dep), when=rocm_dep)
depends_on("heffte {0}".format(rocm_dep), when="+heffte {0}".format(rocm_dep))
depends_on("arborx {0}".format(rocm_dep), when="+arborx {0}".format(rocm_dep))
depends_on("hypre {0}".format(rocm_dep), when="+hypre {0}".format(rocm_dep))

conflicts("+cuda", when="cuda_arch=none")
conflicts("+rocm", when="amdgpu_target=none")

depends_on("kokkos+cuda_lambda", when="+cuda")

# Dependencies for subpackages
depends_on("arborx", when="@0.3.0:+arborx")
depends_on("[email protected]:", when="@0.4.0:+hypre")
depends_on("[email protected]:", when="@0.5.0:+hypre")
# Previous heFFTe pinned at 2.x.0 because its cmakefiles can't roll forward
# compatibilty to later minor versions.
depends_on("[email protected]", when="@0.4.0+heffte")
depends_on("[email protected]", when="@0.5.0:+heffte")
depends_on("[email protected]", when="@0.5.0+heffte")
depends_on("[email protected]:", when="@0.6.0:+heffte")
depends_on("silo", when="@0.5.0:+silo")
depends_on("hdf5", when="@0.6.0:+hdf5")
depends_on("mpi", when="+mpi")

# Cabana automatically builds HDF5 support with newer cmake versions
# in version 0.6.0. This is fixed post-0.6
conflicts("~hdf5", when="@0.6.0 ^cmake@:3.26")

# Cajita support requires MPI
conflicts("+cajita ~mpi")
conflicts("+grid ~mpi")

# Conflict variants only available in newer versions of cabana
conflicts("+rocm", when="@:0.2.0")
conflicts("+sycl", when="@:0.3.0")
conflicts("+silo", when="@:0.3.0")
conflicts("+hdf5", when="@:0.5.0")

def cmake_args(self):
options = [self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
Expand Down
24 changes: 18 additions & 6 deletions var/spack/repos/builtin/packages/silo/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,21 @@ class Silo(AutotoolsPackage):
data to binary, disk files."""

homepage = "https://wci.llnl.gov/simulation/computer-codes/silo"
git = "https://github.com/LLNL/Silo.git"
url = "https://wci.llnl.gov/sites/wci/files/2021-01/silo-4.10.2.tgz"
maintainers("patrickb314")

version(
"4.11.1",
preferred=True,
sha256="49eddc00304aa4a19074b099559edbdcaa3532c98df32f99aa62b9ec3ea7cee2",
url="https://github.com/LLNL/Silo/releases/download/4.11.1/silo-4.11.1.tar.xz",
)
version(
"4.11.1-bsd",
sha256="51ccfdf3c09dfc98c7858a0a6f08cc3b2a07ee3c4142ee6482ba7b24e314c2aa",
url="https://github.com/LLNL/Silo/releases/download/4.11.1/silo-4.11.1-bsd.tar.xz",
)
version(
"4.11",
sha256="ab936c1f4fc158d9fdc4415965f7d9def7f4abeca596fe5a25bd8485654898ac",
Expand Down Expand Up @@ -68,30 +81,29 @@ class Silo(AutotoolsPackage):
patch("H5FD_class_t-terminate.patch", when="@:4.10.2-bsd")

# H5EPR_SEMI_COLON.patch was fixed in current dev
# patch("H5EPR_SEMI_COLON.patch", when="@:4.11-bsd")
patch("H5EPR_SEMI_COLON.patch")
patch("H5EPR_SEMI_COLON.patch", when="@:4.11-bsd")

# Fix missing F77 init, fixed in 4.9
patch("48-configure-f77.patch", when="@:4.8")

# The previously used AX_CHECK_COMPILER_FLAGS macro was dropped from
# autoconf-archive in 2011
patch("configure-AX_CHECK_COMPILE_FLAG.patch")
patch("configure-AX_CHECK_COMPILE_FLAG.patch", when="@:4.11-bsd")

# API changes in hdf5-1.13 cause breakage
# See https://github.com/LLNL/Silo/pull/260
patch("hdf5-113.patch", when="@4.11: +hdf5 ^[email protected]:")
patch("hdf5-113.patch", when="@4.11:4.11-bsd +hdf5 ^[email protected]:")
conflicts("^[email protected]:", when="@:4.10.2-bsd")

# hzip and fpzip are not available in the BSD releases
conflicts("+hzip", when="@4.10.2-bsd,4.11-bsd")
conflicts("+fpzip", when="@4.10.2-bsd,4.11-bsd")

# zfp include missing
patch("zfp_error.patch", when="@4.11 +hdf5")
patch("zfp_error.patch", when="@4.11:4.11-bsd +hdf5")

# use /usr/bin/env perl for portability
patch("mkinc-usr-bin-env-perl.patch")
patch("mkinc-usr-bin-env-perl.patch", when="@:4.11-bsd")

def flag_handler(self, name, flags):
spec = self.spec
Expand Down

0 comments on commit 7cc17f2

Please sign in to comment.