[packages] Fix for cp2k and cosma (#50223)

Signed-off-by: Mathieu Taillefumier <mathieu.taillefumier@free.fr>
Co-authored-by: Mathieu Taillefumier <mathieu.taillefumier@free.fr>
Co-authored-by: Rocco Meli <r.meli@bluemail.ch>
This commit is contained in:
Taillefumier Mathieu 2025-04-30 10:21:33 -04:00 committed by GitHub
parent f1a31fe5f7
commit 883d0739e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 25 additions and 11 deletions

View File

@ -52,7 +52,9 @@ class Cosma(CMakePackage):
with when("+rocm"):
variant("rccl", default=False, description="Use rocm rccl")
depends_on("cxx", type="build") # generated
depends_on("cxx", type="build")
depends_on("c", type="build")
depends_on("fortran", type="build")
depends_on("cmake@3.22:", type="build")
depends_on("mpi@3:")

View File

@ -115,7 +115,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
variant("pytorch", default=False, description="Enable libtorch support")
variant("quip", default=False, description="Enable quip support")
variant("dftd4", when="@2024.2:", default=False, description="Enable DFT-D4 support")
variant("mpi_f08", default=False, description="Use MPI F08 module")
variant("mpi_f08", default=False, description="Use MPI F08 module", when="+mpi")
variant("smeagol", default=False, description="Enable libsmeagol support", when="@2025.2:")
variant(
"pw_gpu", default=True, description="Enable FFT calculations on GPU", when="@2025.2: +cuda"
@ -159,6 +159,13 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
description="Enable TrexIO support",
when="@2025.2: build_system=cmake",
)
variant(
"greenx",
default=False,
description="Enable green X support",
when="@2025.2: build_system=cmake",
)
variant("deepmd", default=False, description="Enable DeepMD-kit support")
conflicts("+deepmd", msg="DeepMD-kit is not yet available in Spack")
@ -208,7 +215,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
depends_on("blas")
depends_on("lapack")
depends_on("fftw-api@3")
depends_on("greenx", when="+greenx")
depends_on("hdf5+hl+fortran", when="+hdf5")
depends_on("trexio", when="+trexio")
@ -637,7 +644,6 @@ def edit(self, pkg, spec, prefix):
)
else:
libs.append(elpa.libs.ld_flags)
if spec.satisfies("@:4"):
if elpa.satisfies("@:2014.5"):
cppflags.append("-D__ELPA")
@ -1050,6 +1056,8 @@ def cmake_args(self):
]
args += [
"-DCP2K_USE_FFTW3=ON",
self.define_from_variant("CP2K_USE_MPI", "mpi"),
self.define_from_variant("CP2K_ENABLE_REGTESTS", "enable_regtests"),
self.define_from_variant("CP2K_USE_ELPA", "elpa"),
self.define_from_variant("CP2K_USE_DLAF", "dlaf"),
@ -1076,8 +1084,12 @@ def cmake_args(self):
self.define_from_variant("CP2K_USE_HDF5", "hdf5"),
self.define_from_variant("CP2K_USE_DEEPMD", "deepmd"),
self.define_from_variant("CP2K_USE_TREXIO", "trexio"),
self.define_from_variant("CP2K_USE_GREENX", "greenx"),
]
if spec.satisfies("^[virtuals=fftw-api] fftw+openmp"):
args += ["-DCP2K_USE_FFTW3_WITH_OPENMP=ON"]
# we force the use elpa openmp threading support. might need to be revisited though
args += [
self.define(
@ -1089,8 +1101,6 @@ def cmake_args(self):
if "spla" in spec and (spec.satisfies("+cuda") or spec.satisfies("+rocm")):
args += ["-DCP2K_USE_SPLA_GEMM_OFFLOADING=ON"]
args += ["-DCP2K_USE_FFTW3=ON"]
if spec.satisfies("smm=libxsmm"):
args += ["-DCP2K_USE_LIBXSMM=ON"]
else:
@ -1100,6 +1110,9 @@ def cmake_args(self):
blas = spec["blas"]
if blas.name == "intel-oneapi-mkl":
if spec.satisfies("^[virtuals=fftw-api] intel-oneapi-mkl"):
args += ["-DCP2K_USE_FFTW3_WITH_MKL=ON"]
args += ["-DCP2K_BLAS_VENDOR=MKL"]
if sys.platform == "darwin":
args += [

View File

@ -31,6 +31,8 @@ class Dbcsr(CMakePackage, CudaPackage, ROCmPackage):
version("2.1.0", sha256="9e58fd998f224632f356e479d18b5032570d00d87b86736b6a6ac2d03f8d4b3c")
version("2.0.1", sha256="61d5531b661e1dab043353a1d67939ddcde3893d3dc7b0ab3d05074d448b485c")
variant("tests", default=False, description="Build DBCSR unit tests")
variant("tests", default=True, description="Build DBCSR unit tests", when="@2.1:2.2")
variant("mpi", default=True, description="Compile with MPI")
variant("openmp", default=False, description="Build with OpenMP support")
variant("shared", default=True, description="Build shared library")
@ -162,12 +164,9 @@ def cmake_args(self):
self.define_from_variant("BUILD_SHARED_LIBS", "shared"),
self.define_from_variant("WITH_EXAMPLES", "examples"),
self.define_from_variant("WITH_G2G", "g2g"),
self.define_from_variant("BUILD_TESTING", "tests"),
]
# Switch necessary as a result of a bug.
if spec.satisfies("@2.1:2.2"):
args += ["-DBUILD_TESTING=ON"]
if self.spec.satisfies("+cuda"):
cuda_arch = self.spec.variants["cuda_arch"].value[0]

View File

@ -95,7 +95,7 @@ class Libxsmm(MakefilePackage):
# A recent `as` is needed to compile libxmss until version 1.17
# (<https://github.com/spack/spack/issues/28404>), but not afterwards
# (<https://github.com/spack/spack/pull/21671#issuecomment-779882282>).
depends_on("binutils+ld+gas@2.33:", type="build", when="@:1.17")
depends_on("binutils+ld+gas@2.33:", type="build")
# Version 2.0 supports both x86_64 and aarch64
requires("target=x86_64:", "target=aarch64:")