FIX: opal-x build

This commit is contained in:
svcusr-spack (Resp. Germann Elsa Sylvia)
2024-10-04 09:54:42 +02:00
parent 51daa45753
commit eef26d712c
2 changed files with 116 additions and 14 deletions

104
packages/ippl/package.py Normal file
View File

@ -0,0 +1,104 @@
# 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)
# ----------------------------------------------------------------------------
# If you submit this package back to Spack as a pull request,
# please first remove this boilerplate and all FIXME comments.
#
# This is a template package file for Spack. We've put "FIXME"
# next to all the things you'll want to change. Once you've handled
# them, you can save this file and test your package like this:
#
# spack install ippl
#
# You can edit this file again by typing:
#
# spack edit ippl
#
# See the Spack documentation for more information on packaging.
# ----------------------------------------------------------------------------
from spack.package import *
class Ippl(CMakePackage, CudaPackage):
"""Independent Parallel Particle Layer (IPPL) is a performance portable C++ library for Particle-Mesh methods. IPPL makes use of Kokkos (https://github.com/kokkos/kokkos), HeFFTe (https://github.com/icl-utk-edu/heffte), and MPI (Message Passing Interface) to deliver a portable, massively parallel toolkit for particle-mesh methods. IPPL supports simulations in one to six dimensions, mixed precision, and asynchronous execution in different execution spaces (e.g. CPUs and GPUs)."""
homepage = "https://github.com/IPPL-framework/ippl"
url = "https://github.com/IPPL-framework/ippl/archive/refs/tags/IPPL-3.2.0.tar.gz"
git="https://github.com/IPPL-framework/ippl.git"
maintainers("germanne", "gsell")
license("GPLv3")
version("3.2.0", sha256="041a4efbddaba5b477dae01ab166354da7dee01cf625706e19f5b60c0c3f6b88")
depends_on("kokkos@4.2.00:+openmp")
depends_on("heffte@develop")
variant(
"build_type",
default="Release",
description="CMake build type",
values=("Debug", "Release", "RelWithDebInfo", "MinSizeRel"),
)
variant("mpi", default=True, description="Enable MPI support")
variant(
"platforms",
default=True,
description="Set IPPL platforms",
values=("serial", "openmp", "cuda", "openmp/cuda")
)
variant("solvers", default=True, description="Enable solvers")
variant("fft", default=True, description="Enable full-wave solver")
variant("tests", default=False, description="Enable tests")
variant("unit_tests", default=False, description="Enable unit tests")
variant("alternative_variant", default=False, description="Use alternative variant")
variant("alpine", default=False, description="Enable Alpine")
depends_on("cmake@3.25.2:", type="build")
depends_on("fftw@3.3.10", when="+fft")
depends_on("kokkos@4.2.00:+openmp")
depends_on("heffte@develop")
depends_on("kokkos@4.2.00:+cuda", when="+cuda")
depends_on("heffte+fftw", when="+fft")
depends_on("heffte+cuda", when="+cuda")
conflicts("~mpi", msg="IPPL can not run without mpi!")
conflicts("cuda_arch=none", when="+cuda",
msg="CUDA architecture is required")
conflicts("~cuda", when="platform=cuda",
msg="CUDA is required for platform cuda.")
def cmake_args(self):
args = [
"-DCMAKE_CXX_STANDARD=20",
self.define_from_variant("ENABLE_FFT", "fft"),
self.define_from_variant("ENABLE_SOLVERS", "solvers"),
self.define_from_variant("ENABLE_TESTS", "tests"),
self.define_from_variant("ENABLE_UNIT_TESTS", "unit_tests"),
self.define_from_variant("USE_ALTERNATIVE_VARIANT", "alternative_variant"),
self.define_from_variant("ENABLE_ALPINE", "alpine"),
]
if 'platform=cuda' in self.variants:
args.append("-DIPPL_PLATFORMS=CUDA")
elif 'platform=openmp' in self.variants:
args.append("-DIPPL_PLATFORMS=OPENMP")
elif 'platform=openmp/cuda' in self.variants:
args.append("-DIPPL_PLATFORMS=OPENMP;CUDA")
else:
args.append("-DIPPL_PLATFORMS=SERIAL")
if 'cuda_arch=90' in self.variants:
args.append("-DKokkos_ARCH_HOPPER90=ON")
elif 'cuda_arch=80' in self.variants:
args.append("-DKokkos_ARCH_AMPERE80=ON")
elif 'cuda_arch=60' in self.variants:
args.append("-DKokkos_ARCH_PASCAL61=ON")
return args

View File

@ -48,17 +48,15 @@ class OpalX(CMakePackage, CudaPackage):
variant("solvers", default=True, description="Enable solvers") variant("solvers", default=True, description="Enable solvers")
variant("fft", default=True, description="Enable full-wave solver") variant("fft", default=True, description="Enable full-wave solver")
variant("tests", default=False, description="Enable tests") variant("tests", default=False, description="Enable tests")
variant("alternative_variant", default=True, description="Use alternative variant") variant("alternative_variant", default=False, description="Use alternative variant")
variant("alpine", default=True, description="Enable Alpine") variant("alpine", default=False, description="Enable Alpine")
depends_on("blas") depends_on("blas")
depends_on("boost@1.82.0+mpi+chrono+filesystem+iostreams+regex+serialization+system+timer+python+shared") depends_on("boost@1.82.0+mpi+chrono+filesystem+iostreams+regex+serialization+system+timer+python+shared")
depends_on("cmake@3.25.2:", type="build") depends_on("cmake@3.25.2:", type="build")
depends_on("fftw@3.3.10", when="+fft") depends_on("fftw@3.3.10")
depends_on("gsl@2.7+shared") depends_on("gsl@2.7+shared")
depends_on("gnutls@3.5.19:") depends_on("gnutls@3.5.19:")
depends_on("kokkos@4.2.00:+openmp")
depends_on("heffte@develop")
depends_on("h5hut+mpi", when="+mpi") depends_on("h5hut+mpi", when="+mpi")
@ -73,7 +71,7 @@ class OpalX(CMakePackage, CudaPackage):
conflicts("cuda_arch=none", when="+cuda", conflicts("cuda_arch=none", when="+cuda",
msg="CUDA architecture is required") msg="CUDA architecture is required")
conflicts("%gcc@:8.5.0", msg="gcc bigger than 8.5.0 is required") conflicts("%gcc@:8.5.0", msg="gcc bigger than 8.5.0 is required")
@run_before("cmake") @run_before("cmake")
def cmake_configure(self): def cmake_configure(self):
spec = self.spec spec = self.spec
@ -87,21 +85,21 @@ class OpalX(CMakePackage, CudaPackage):
self.define_from_variant("ENABLE_SOLVERS", "solvers"), self.define_from_variant("ENABLE_SOLVERS", "solvers"),
self.define_from_variant("ENABLE_TESTS", "tests"), self.define_from_variant("ENABLE_TESTS", "tests"),
self.define_from_variant("USE_ALTERNATIVE_VARIANT", "alternative_variant"), self.define_from_variant("USE_ALTERNATIVE_VARIANT", "alternative_variant"),
#self.define_from_variant("ENABLE_ALPINE", "alpine"), "-DIPPL_GIT_TAG=opalx-fielddump",
] ]
if '+cuda' in self.variants: if '+cuda' in self.spec:
args.append("-DIPPL_PLATFORMS=cuda") args.append("-DIPPL_PLATFORMS=cuda")
else: else:
args.append("-DIPPL_PLATFORMS=openmp") args.append("-DIPPL_PLATFORMS=openmp")
if 'cuda_arch=90' in self.variants: if 'cuda_arch=90' in self.spec:
args.append("-DKokkos_ARCH_HOPPER90=ON") args.append("-DKokkos_ARCH_HOPPER90=ON")
elif 'cuda_arch=80' in self.variants: elif 'cuda_arch=80' in self.spec:
args.append("-DKokkos_ARCH_AMPERE80=ON") args.append("-DKokkos_ARCH_AMPERE80=ON")
elif 'cuda_arch=60' in self.variants: elif 'cuda_arch=60' in self.spec:
args.append("-DKokkos_ARCH_PASCAL61=ON") args.append("-DKokkos_ARCH_PASCAL61=ON")
return args return args