From 2b9d61ba22ef244640604e2472775224877853ca Mon Sep 17 00:00:00 2001 From: Mathieu Taillefumier Date: Sun, 7 Jun 2026 13:44:17 +0200 Subject: [PATCH 1/3] [PACKAGE] Added libxs - Added libxs dependency - Updated cp2k --- .../builtin/packages/cp2k/package.py | 244 ++++++++++++++---- .../builtin/packages/libxs/package.py | 47 ++++ 2 files changed, 237 insertions(+), 54 deletions(-) create mode 100644 repos/spack_repo/builtin/packages/libxs/package.py diff --git a/repos/spack_repo/builtin/packages/cp2k/package.py b/repos/spack_repo/builtin/packages/cp2k/package.py index 9ff9a5257e7..aff3dce5c05 100644 --- a/repos/spack_repo/builtin/packages/cp2k/package.py +++ b/repos/spack_repo/builtin/packages/cp2k/package.py @@ -51,20 +51,58 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): license("GPL-2.0-or-later") - version("2026.1", sha256="4364c74bcffaa474bc234e11686b09550e4d06932acf2147a341e4f7679dd88e") - version("2025.2", sha256="c8392a4e123304644ec8d241443796277c6ed7ae977452317e779f3c387c2e19") - version("2025.1", sha256="65c8ad5488897b0f995919b9fa77f2aba4b61677ba1e3c19bb093d5c08a8ce1d") - version("2024.3", sha256="a6eeee773b6b1fb417def576e4049a89a08a0ed5feffcd7f0b33c7d7b48f19ba") - version("2024.2", sha256="cc3e56c971dee9e89b705a1103765aba57bf41ad39a11c89d3de04c8b8cdf473") - version("2024.1", sha256="a7abf149a278dfd5283dc592a2c4ae803b37d040df25d62a5e35af5c4557668f") - version("2023.2", sha256="adbcc903c1a78cba98f49fe6905a62b49f12e3dfd7cedea00616d1a5f50550db") - version("2023.1", sha256="dff343b4a80c3a79363b805429bdb3320d3e1db48e0ff7d20a3dfd1c946a51ce") - version("2022.2", sha256="1a473dea512fe264bb45419f83de432d441f90404f829d89cbc3a03f723b8354") - version("2022.1", sha256="2c34f1a7972973c62d471cd35856f444f11ab22f2ff930f6ead20f3454fd228b") - version("9.1", sha256="fedb4c684a98ad857cd49b69a3ae51a73f85a9c36e9cb63e3b02320c74454ce6") - version("8.2", sha256="2e24768720efed1a5a4a58e83e2aca502cd8b95544c21695eb0de71ed652f20a") - version("8.1", sha256="7f37aead120730234a60b2989d0547ae5e5498d93b1e9b5eb548c041ee8e7772") - version("7.1", sha256="ccd711a09a426145440e666310dd01cc5772ab103493c4ae6a3470898cd0addb") + version( + "2026.1", + sha256="4364c74bcffaa474bc234e11686b09550e4d06932acf2147a341e4f7679dd88e", + ) + version( + "2025.2", + sha256="c8392a4e123304644ec8d241443796277c6ed7ae977452317e779f3c387c2e19", + ) + version( + "2025.1", + sha256="65c8ad5488897b0f995919b9fa77f2aba4b61677ba1e3c19bb093d5c08a8ce1d", + ) + version( + "2024.3", + sha256="a6eeee773b6b1fb417def576e4049a89a08a0ed5feffcd7f0b33c7d7b48f19ba", + ) + version( + "2024.2", + sha256="cc3e56c971dee9e89b705a1103765aba57bf41ad39a11c89d3de04c8b8cdf473", + ) + version( + "2024.1", + sha256="a7abf149a278dfd5283dc592a2c4ae803b37d040df25d62a5e35af5c4557668f", + ) + version( + "2023.2", + sha256="adbcc903c1a78cba98f49fe6905a62b49f12e3dfd7cedea00616d1a5f50550db", + ) + version( + "2023.1", + sha256="dff343b4a80c3a79363b805429bdb3320d3e1db48e0ff7d20a3dfd1c946a51ce", + ) + version( + "2022.2", + sha256="1a473dea512fe264bb45419f83de432d441f90404f829d89cbc3a03f723b8354", + ) + version( + "2022.1", + sha256="2c34f1a7972973c62d471cd35856f444f11ab22f2ff930f6ead20f3454fd228b", + ) + version( + "9.1", sha256="fedb4c684a98ad857cd49b69a3ae51a73f85a9c36e9cb63e3b02320c74454ce6" + ) + version( + "8.2", sha256="2e24768720efed1a5a4a58e83e2aca502cd8b95544c21695eb0de71ed652f20a" + ) + version( + "8.1", sha256="7f37aead120730234a60b2989d0547ae5e5498d93b1e9b5eb548c041ee8e7772" + ) + version( + "7.1", sha256="ccd711a09a426145440e666310dd01cc5772ab103493c4ae6a3470898cd0addb" + ) version("master", branch="master", submodules=True) generator("ninja") @@ -80,9 +118,13 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): variant("opencl", default=False, description="Enable OpenCL backend") variant("plumed", default=False, description="Enable PLUMED support") variant( - "libint", default=True, description="Use libint, required for HFX (and possibly others)" + "libint", + default=True, + description="Use libint, required for HFX (and possibly others)", + ) + variant( + "libxc", default=True, description="Support additional functionals via libxc" ) - variant("libxc", default=True, description="Support additional functionals via libxc") variant( "pexsi", default=False, @@ -130,16 +172,33 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): when="@2026.2: build_system=cmake", ) variant("quip", default=False, when="@:2025.2", description="Enable quip support") - variant("dftd4", when="@2024.2:", default=False, description="Enable DFT-D4 support") + variant( + "dftd4", when="@2024.2:", default=False, description="Enable DFT-D4 support" + ) variant("mpi_f08", default=False, description="Use MPI F08 module", when="+mpi") - variant("smeagol", default=False, description="Enable libsmeagol support", when="@2025.2:") - variant("dbm_gpu", default=True, description="Enable DBM GPU backend", when="@2025.2:") - variant("grid_gpu", default=True, description="Enable grid GPU backend", when="@2025.2:") variant( - "grid_gpu", default=False, description="Enable grid GPU backend", when="@2025.2: +opencl" + "smeagol", + default=False, + description="Enable libsmeagol support", + when="@2025.2:", + ) + variant( + "dbm_gpu", default=True, description="Enable DBM GPU backend", when="@2025.2:" ) variant( - "pw_gpu", default=True, description="Enable FFT calculations on GPU", when="@2025.2: +cuda" + "grid_gpu", default=True, description="Enable grid GPU backend", when="@2025.2:" + ) + variant( + "grid_gpu", + default=False, + description="Enable grid GPU backend", + when="@2025.2: +opencl", + ) + variant( + "pw_gpu", + default=True, + description="Enable FFT calculations on GPU", + when="@2025.2: +cuda", ) variant( "pw_gpu", @@ -147,6 +206,9 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): description="Enable FFT calculations on GPU", when="@2025.2: +rocm", ) + + variant("libxs", default=False, description="Enable libxs support", when="@master") + variant( "pw_gpu", default=False, @@ -191,11 +253,28 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): when="@2025.2: build_system=cmake", ) - variant("vdwxc", default=False, description="Enable VDW support in SIRIUS.", when="+sirius") + variant( + "vdwxc", + default=False, + description="Enable VDW support in SIRIUS.", + when="+sirius", + ) variant("deepmd", default=False, description="Enable DeepMD-kit support") - variant("tblite", default=False, description="Enable tblite support", when="@2025.2:") - variant("nlcg", default=False, description="Enable nlcg support in sirius", when="+sirius") - variant("vcsqnm", default=False, description="Enable VCSQNM support in sirius", when="+sirius") + variant( + "tblite", default=False, description="Enable tblite support", when="@2025.2:" + ) + variant( + "nlcg", + default=False, + description="Enable nlcg support in sirius", + when="+sirius", + ) + variant( + "vcsqnm", + default=False, + description="Enable VCSQNM support in sirius", + when="+sirius", + ) conflicts("+deepmd", msg="DeepMD-kit is not yet available in Spack") @@ -210,7 +289,9 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): ), ) variant( - "cuda_fft", default=False, description="Use CUDA also for FFTs in the PW part of CP2K" + "cuda_fft", + default=False, + description="Use CUDA also for FFTs in the PW part of CP2K", ) variant( "cuda_blas", @@ -244,6 +325,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): depends_on("blas") depends_on("lapack") + depends_on("libxs", when="+libxs") depends_on("fftw-api@3") depends_on("greenx", when="+greenx") depends_on("hdf5+hl+fortran", when="+hdf5") @@ -257,12 +339,17 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): depends_on("cray-fftw+openmp", when="^[virtuals=fftw-api] cray-fftw") depends_on("armpl-gcc threads=openmp", when="^[virtuals=blas] armpl-gcc") depends_on("openblas threads=openmp", when="^[virtuals=blas] openblas") - depends_on("intel-oneapi-mkl threads=openmp", when="^[virtuals=fftw-api] intel-oneapi-mkl") + depends_on( + "intel-oneapi-mkl threads=openmp", + when="^[virtuals=fftw-api] intel-oneapi-mkl", + ) depends_on( "intel-oneapi-mkl+gfortran threads=openmp", when="^[virtuals=blas] intel-oneapi-mkl %gcc", ) - depends_on("intel-oneapi-mkl threads=openmp", when="^[virtuals=blas] intel-oneapi-mkl") + depends_on( + "intel-oneapi-mkl threads=openmp", when="^[virtuals=blas] intel-oneapi-mkl" + ) # The Cray compiler wrappers will automatically add libsci_mp with # -fopenmp. Since CP2K unconditionally links blas/lapack/scalapack # we have to be consistent. @@ -287,10 +374,14 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): with when("+libint"): depends_on("pkgconfig", type="build", when="@7.0:") for lmax in HFX_LMAX_RANGE: - depends_on(f"libint@2.6.0:+fortran tune=cp2k-lmax-{lmax}", when=f"@7.0: lmax={lmax}") + depends_on( + f"libint@2.6.0:+fortran tune=cp2k-lmax-{lmax}", + when=f"@7.0: lmax={lmax}", + ) # AOCC only works with libint@2.6.0 depends_on( - f"libint@=2.6.0+fortran tune=cp2k-lmax-{lmax}", when=f"@7.0: lmax={lmax} %aocc" + f"libint@=2.6.0+fortran tune=cp2k-lmax-{lmax}", + when=f"@7.0: lmax={lmax} %aocc", ) with when("+libxc"): @@ -312,7 +403,9 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): depends_on("mpi@3:", when="@2023.1:") depends_on("scalapack") depends_on("mpich+fortran", when="^[virtuals=mpi] mpich") - depends_on("intel-oneapi-mkl +cluster", when="^[virtuals=scalapack] intel-oneapi-mkl") + depends_on( + "intel-oneapi-mkl +cluster", when="^[virtuals=scalapack] intel-oneapi-mkl" + ) conflicts("~mpi_f08", when="^mpich@4.1:") with when("+cosma"): @@ -440,7 +533,9 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): msg="Please use AOCC 4.0+ that better support modern Fortran features CP2K requires", ) - conflicts("~openmp", when="@8:", msg="Building without OpenMP is not supported in CP2K 8+") + conflicts( + "~openmp", when="@8:", msg="Building without OpenMP is not supported in CP2K 8+" + ) # We only support specific cuda_archs for which we have parameter files # for optimal kernels. Note that we don't override the cuda_archs property @@ -545,15 +640,23 @@ def patch(self): for directory, subdirectory, files in os.walk(os.getcwd()): for i in files: file_path = os.path.join(directory, i) - filter_file("USE ISO_C_BINDING", "USE,INTRINSIC :: ISO_C_BINDING", file_path) filter_file( - "USE ISO_FORTRAN_ENV", "USE,INTRINSIC :: ISO_FORTRAN_ENV", file_path + "USE ISO_C_BINDING", "USE,INTRINSIC :: ISO_C_BINDING", file_path + ) + filter_file( + "USE ISO_FORTRAN_ENV", + "USE,INTRINSIC :: ISO_FORTRAN_ENV", + file_path, ) filter_file("USE omp_lib", "USE,INTRINSIC :: omp_lib", file_path) filter_file("USE OMP_LIB", "USE,INTRINSIC :: OMP_LIB", file_path) - filter_file("USE iso_c_binding", "USE,INTRINSIC :: iso_c_binding", file_path) filter_file( - "USE iso_fortran_env", "USE,INTRINSIC :: iso_fortran_env", file_path + "USE iso_c_binding", "USE,INTRINSIC :: iso_c_binding", file_path + ) + filter_file( + "USE iso_fortran_env", + "USE,INTRINSIC :: iso_fortran_env", + file_path, ) def url_for_version(self, version): @@ -701,8 +804,12 @@ def edit(self, pkg, spec, prefix): fcflags.append("-I" + join_path(spec["pexsi"].prefix, "fortran")) libs += [ join_path(spec["pexsi"].libs.directories[0], "libpexsi.a"), - join_path(spec["superlu-dist"].libs.directories[0], "libsuperlu_dist.a"), - join_path(spec["parmetis"].libs.directories[0], f"libparmetis.{dso_suffix}"), + join_path( + spec["superlu-dist"].libs.directories[0], "libsuperlu_dist.a" + ), + join_path( + spec["parmetis"].libs.directories[0], f"libparmetis.{dso_suffix}" + ), join_path(spec["metis"].libs.directories[0], f"libmetis.{dso_suffix}"), ] @@ -717,7 +824,8 @@ def edit(self, pkg, spec, prefix): if spec.satisfies("%aocc"): libs.append( join_path( - elpa.prefix.lib, ("libelpa{elpa_suffix}.a".format(elpa_suffix=elpa_suffix)) + elpa.prefix.lib, + ("libelpa{elpa_suffix}.a".format(elpa_suffix=elpa_suffix)), ) ) else: @@ -788,7 +896,9 @@ def edit(self, pkg, spec, prefix): "-D__USE_CP2K_TRACE", ] ) - fcflags.extend(["-free", "-fpp", "-diag-disable 8290,8291,10010,10212,11060"]) + fcflags.extend( + ["-free", "-fpp", "-diag-disable 8290,8291,10010,10212,11060"] + ) # FFTW, LAPACK, BLAS lapack = spec["lapack"].libs @@ -815,15 +925,22 @@ def edit(self, pkg, spec, prefix): cppflags.extend(["-D__parallel", "-D__SCALAPACK"]) if spec["mpi"].name == "intel-oneapi-mpi": - mpi = [join_path(spec["intel-oneapi-mpi"].libs.directories[0], "libmpi.so")] + mpi = [ + join_path(spec["intel-oneapi-mpi"].libs.directories[0], "libmpi.so") + ] else: mpi = spec["mpi:cxx"].libs if spec["scalapack"].name == "intel-oneapi-mkl": - mpi_impl = "openmpi" if spec["mpi"].name in ["openmpi", "hpcx-mpi"] else "intelmpi" + mpi_impl = ( + "openmpi" + if spec["mpi"].name in ["openmpi", "hpcx-mpi"] + else "intelmpi" + ) scalapack = [ join_path( - spec["intel-oneapi-mkl"].libs.directories[0], "libmkl_scalapack_lp64.so" + spec["intel-oneapi-mkl"].libs.directories[0], + "libmkl_scalapack_lp64.so", ), join_path( spec["intel-oneapi-mkl"].libs.directories[0], @@ -843,7 +960,9 @@ def edit(self, pkg, spec, prefix): if spec.satisfies("^wannier90"): cppflags.append("-D__WANNIER90") - wannier = join_path(spec["wannier90"].libs.directories[0], "libwannier.a") + wannier = join_path( + spec["wannier90"].libs.directories[0], "libwannier.a" + ) libs.append(wannier) gpuver = "" @@ -912,7 +1031,9 @@ def edit(self, pkg, spec, prefix): gpuver = GPU_MAP[spec.variants["amdgpu_target"].value[0]] if spec.satisfies("smm=libsmm"): - lib_dir = join_path("lib", self.makefile_architecture, self.makefile_version) + lib_dir = join_path( + "lib", self.makefile_architecture, self.makefile_version + ) mkdirp(lib_dir) try: copy(env["LIBSMM_PATH"], join_path(lib_dir, "libsmm.a")) @@ -949,7 +1070,9 @@ def edit(self, pkg, spec, prefix): mkf.write("include {0}\n".format(self.pkg["plumed"].plumed_inc)) mkf.write("\n# COMPILER, LINKER, TOOLS\n\n") - mkf.write("FC = {0}\nCC = {1}\nCXX = {2}\nLD = {3}\n".format(fc, cc, cxx, fc)) + mkf.write( + "FC = {0}\nCC = {1}\nCXX = {2}\nLD = {3}\n".format(fc, cc, cxx, fc) + ) if spec.satisfies("%intel"): intel_bin_dir = ancestor(pkg.compiler.cc) @@ -1045,7 +1168,9 @@ def build_targets(self): @property def makefile(self): - makefile_basename = ".".join([self.makefile_architecture, self.makefile_version]) + makefile_basename = ".".join( + [self.makefile_architecture, self.makefile_version] + ) return join_path("arch", makefile_basename) @property @@ -1087,7 +1212,9 @@ def fix_package_config(self): to generate and override entire libcp2k.pc. """ pkgconfig_file = join_path(self.prefix.lib.pkgconfig, "libcp2k.pc") - filter_file(r"(^includedir=).*", r"\1{0}".format(self.prefix.include), pkgconfig_file) + filter_file( + r"(^includedir=).*", r"\1{0}".format(self.prefix.include), pkgconfig_file + ) filter_file(r"(^libdir=).*", r"\1{0}".format(self.prefix.lib), pkgconfig_file) with open(pkgconfig_file, "r+") as handle: @@ -1098,7 +1225,9 @@ def fix_package_config(self): content += " " + self.spec["fftw-api"].libs.ld_flags fftw = self.spec["fftw-api"] - if fftw.name in ["fftw", "amdfftw", "cray-fftw"] and fftw.satisfies("+openmp"): + if fftw.name in ["fftw", "amdfftw", "cray-fftw"] and fftw.satisfies( + "+openmp" + ): content += " -lfftw3_omp" content += "\n" @@ -1116,7 +1245,9 @@ def cmake_args(self): args += [self.define("CP2K_USE_ACCEL", "OPENCL")] if spec.satisfies("+cuda"): - if (len(spec.variants["cuda_arch"].value) > 1) or spec.satisfies("cuda_arch=none"): + if (len(spec.variants["cuda_arch"].value) > 1) or spec.satisfies( + "cuda_arch=none" + ): raise InstallError("CP2K supports only one cuda_arch at a time.") else: gpu_ver = GPU_MAP[spec.variants["cuda_arch"].value[0]] @@ -1173,6 +1304,7 @@ def cmake_args(self): self.define_from_variant("CP2K_USE_GREENX", "greenx"), self.define_from_variant("CP2K_USE_LIBVDWXC", "vdwxc"), self.define_from_variant("CP2K_USE_TBLITE", "tblite"), + self.define_from_variant("CP2K_USE_LIBXS", "libxs"), ] if spec.satisfies("+sirius"): @@ -1217,7 +1349,8 @@ def cmake_args(self): self.define("CP2K_BLAS_VENDOR", "CUSTOM"), self.define("CP2K_SCALAPACK_VENDOR", "GENERIC"), self.define( - "CP2K_SCALAPACK_LINK_LIBRARIES", spec["scalapack"].libs.joined(";") + "CP2K_SCALAPACK_LINK_LIBRARIES", + spec["scalapack"].libs.joined(";"), ), ] else: @@ -1230,11 +1363,14 @@ def cmake_args(self): self.define("CP2K_BLAS_FOUND", True), self.define("CP2K_BLAS_LINK_LIBRARIES", blas.libs.joined(";")), self.define("CP2K_SCALAPACK_FOUND", True), - self.define("CP2K_SCALAPACK_INCLUDE_DIRS", spec["scalapack"].prefix.include), + self.define( + "CP2K_SCALAPACK_INCLUDE_DIRS", spec["scalapack"].prefix.include + ), self.define("CP2K_BLAS_VENDOR", "CUSTOM"), self.define("CP2K_SCALAPACK_VENDOR", "GENERIC"), self.define( - "CP2K_SCALAPACK_LINK_LIBRARIES", spec["scalapack"].libs.joined(";") + "CP2K_SCALAPACK_LINK_LIBRARIES", + spec["scalapack"].libs.joined(";"), ), ] ) diff --git a/repos/spack_repo/builtin/packages/libxs/package.py b/repos/spack_repo/builtin/packages/libxs/package.py new file mode 100644 index 00000000000..636cc6f3950 --- /dev/null +++ b/repos/spack_repo/builtin/packages/libxs/package.py @@ -0,0 +1,47 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack_repo.builtin.build_systems.cmake import CMakePackage +from spack.package import * + + +class Libxs(CMakePackage): + """LIBXS is a portable C library providing building blocks for memory + operations, numerics, synchronization, and more -- with a focus on + performance and minimal dependencies. Targets x86-64, AArch64, and RISC-V; + requires only a C89 compiler. Originally developed as part of LIBXSMM. + """ + + maintainers("hfp", "mkrack", "mtaillefumier") + + homepage = "hhttps://libxs.readthedocs.io/en/latest" + url = "https://github.com/hfp/libxs/archiv/libxs-ab416130f8c9f7edb8c1bf3d3abaf402f61d0fe0.tar.gz" + git = "https://github.com/hfp/libxs.git" + + license("BSD-3-Clause", checked_by="mkrack") + + version("main", branch="main") + version("20260605", commit="ab416130f8c9f7edb8c1bf3d3abaf402f61d0fe0") + + variant("fortran", default=False, description="Build Fortran module interface") + variant("pic", default=True, description="Build position independent code") + variant( + "shared", default=False, description="Build shared libraries (otherwise static)" + ) + + depends_on("cmake@3.13:", type="build") + depends_on("c", type="build") + depends_on("cxx", type="build") + depends_on("fortran", type="build", when="+fortran") + + depends_on("libxsmm") + + def cmake_args(self): + spec = self.spec + args = [ + self.define_from_variant("LIBXS_FORTRAN", "fortran"), + self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"), + self.define_from_variant("LIBXS_SHARED", "shared"), + ] + return args From 8e5f9e9d3fafda33968caa6cfb472d5e8c7b68c7 Mon Sep 17 00:00:00 2001 From: mtaillefumier Date: Sun, 7 Jun 2026 11:58:50 +0000 Subject: [PATCH 2/3] [@spackbot] updating style on behalf of mtaillefumier --- .../builtin/packages/cp2k/package.py | 110 +++++------------- .../builtin/packages/libxs/package.py | 9 +- 2 files changed, 32 insertions(+), 87 deletions(-) diff --git a/repos/spack_repo/builtin/packages/cp2k/package.py b/repos/spack_repo/builtin/packages/cp2k/package.py index aff3dce5c05..c914d24c0ec 100644 --- a/repos/spack_repo/builtin/packages/cp2k/package.py +++ b/repos/spack_repo/builtin/packages/cp2k/package.py @@ -91,18 +91,10 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): "2022.1", sha256="2c34f1a7972973c62d471cd35856f444f11ab22f2ff930f6ead20f3454fd228b", ) - version( - "9.1", sha256="fedb4c684a98ad857cd49b69a3ae51a73f85a9c36e9cb63e3b02320c74454ce6" - ) - version( - "8.2", sha256="2e24768720efed1a5a4a58e83e2aca502cd8b95544c21695eb0de71ed652f20a" - ) - version( - "8.1", sha256="7f37aead120730234a60b2989d0547ae5e5498d93b1e9b5eb548c041ee8e7772" - ) - version( - "7.1", sha256="ccd711a09a426145440e666310dd01cc5772ab103493c4ae6a3470898cd0addb" - ) + version("9.1", sha256="fedb4c684a98ad857cd49b69a3ae51a73f85a9c36e9cb63e3b02320c74454ce6") + version("8.2", sha256="2e24768720efed1a5a4a58e83e2aca502cd8b95544c21695eb0de71ed652f20a") + version("8.1", sha256="7f37aead120730234a60b2989d0547ae5e5498d93b1e9b5eb548c041ee8e7772") + version("7.1", sha256="ccd711a09a426145440e666310dd01cc5772ab103493c4ae6a3470898cd0addb") version("master", branch="master", submodules=True) generator("ninja") @@ -122,9 +114,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): default=True, description="Use libint, required for HFX (and possibly others)", ) - variant( - "libxc", default=True, description="Support additional functionals via libxc" - ) + variant("libxc", default=True, description="Support additional functionals via libxc") variant( "pexsi", default=False, @@ -172,9 +162,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): when="@2026.2: build_system=cmake", ) variant("quip", default=False, when="@:2025.2", description="Enable quip support") - variant( - "dftd4", when="@2024.2:", default=False, description="Enable DFT-D4 support" - ) + variant("dftd4", when="@2024.2:", default=False, description="Enable DFT-D4 support") variant("mpi_f08", default=False, description="Use MPI F08 module", when="+mpi") variant( "smeagol", @@ -182,12 +170,8 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): description="Enable libsmeagol support", when="@2025.2:", ) - variant( - "dbm_gpu", default=True, description="Enable DBM GPU backend", when="@2025.2:" - ) - variant( - "grid_gpu", default=True, description="Enable grid GPU backend", when="@2025.2:" - ) + variant("dbm_gpu", default=True, description="Enable DBM GPU backend", when="@2025.2:") + variant("grid_gpu", default=True, description="Enable grid GPU backend", when="@2025.2:") variant( "grid_gpu", default=False, @@ -260,9 +244,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): when="+sirius", ) variant("deepmd", default=False, description="Enable DeepMD-kit support") - variant( - "tblite", default=False, description="Enable tblite support", when="@2025.2:" - ) + variant("tblite", default=False, description="Enable tblite support", when="@2025.2:") variant( "nlcg", default=False, @@ -347,9 +329,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): "intel-oneapi-mkl+gfortran threads=openmp", when="^[virtuals=blas] intel-oneapi-mkl %gcc", ) - depends_on( - "intel-oneapi-mkl threads=openmp", when="^[virtuals=blas] intel-oneapi-mkl" - ) + depends_on("intel-oneapi-mkl threads=openmp", when="^[virtuals=blas] intel-oneapi-mkl") # The Cray compiler wrappers will automatically add libsci_mp with # -fopenmp. Since CP2K unconditionally links blas/lapack/scalapack # we have to be consistent. @@ -403,9 +383,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): depends_on("mpi@3:", when="@2023.1:") depends_on("scalapack") depends_on("mpich+fortran", when="^[virtuals=mpi] mpich") - depends_on( - "intel-oneapi-mkl +cluster", when="^[virtuals=scalapack] intel-oneapi-mkl" - ) + depends_on("intel-oneapi-mkl +cluster", when="^[virtuals=scalapack] intel-oneapi-mkl") conflicts("~mpi_f08", when="^mpich@4.1:") with when("+cosma"): @@ -533,9 +511,7 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage): msg="Please use AOCC 4.0+ that better support modern Fortran features CP2K requires", ) - conflicts( - "~openmp", when="@8:", msg="Building without OpenMP is not supported in CP2K 8+" - ) + conflicts("~openmp", when="@8:", msg="Building without OpenMP is not supported in CP2K 8+") # We only support specific cuda_archs for which we have parameter files # for optimal kernels. Note that we don't override the cuda_archs property @@ -640,9 +616,7 @@ def patch(self): for directory, subdirectory, files in os.walk(os.getcwd()): for i in files: file_path = os.path.join(directory, i) - filter_file( - "USE ISO_C_BINDING", "USE,INTRINSIC :: ISO_C_BINDING", file_path - ) + filter_file("USE ISO_C_BINDING", "USE,INTRINSIC :: ISO_C_BINDING", file_path) filter_file( "USE ISO_FORTRAN_ENV", "USE,INTRINSIC :: ISO_FORTRAN_ENV", @@ -650,9 +624,7 @@ def patch(self): ) filter_file("USE omp_lib", "USE,INTRINSIC :: omp_lib", file_path) filter_file("USE OMP_LIB", "USE,INTRINSIC :: OMP_LIB", file_path) - filter_file( - "USE iso_c_binding", "USE,INTRINSIC :: iso_c_binding", file_path - ) + filter_file("USE iso_c_binding", "USE,INTRINSIC :: iso_c_binding", file_path) filter_file( "USE iso_fortran_env", "USE,INTRINSIC :: iso_fortran_env", @@ -804,12 +776,8 @@ def edit(self, pkg, spec, prefix): fcflags.append("-I" + join_path(spec["pexsi"].prefix, "fortran")) libs += [ join_path(spec["pexsi"].libs.directories[0], "libpexsi.a"), - join_path( - spec["superlu-dist"].libs.directories[0], "libsuperlu_dist.a" - ), - join_path( - spec["parmetis"].libs.directories[0], f"libparmetis.{dso_suffix}" - ), + join_path(spec["superlu-dist"].libs.directories[0], "libsuperlu_dist.a"), + join_path(spec["parmetis"].libs.directories[0], f"libparmetis.{dso_suffix}"), join_path(spec["metis"].libs.directories[0], f"libmetis.{dso_suffix}"), ] @@ -896,9 +864,7 @@ def edit(self, pkg, spec, prefix): "-D__USE_CP2K_TRACE", ] ) - fcflags.extend( - ["-free", "-fpp", "-diag-disable 8290,8291,10010,10212,11060"] - ) + fcflags.extend(["-free", "-fpp", "-diag-disable 8290,8291,10010,10212,11060"]) # FFTW, LAPACK, BLAS lapack = spec["lapack"].libs @@ -925,18 +891,12 @@ def edit(self, pkg, spec, prefix): cppflags.extend(["-D__parallel", "-D__SCALAPACK"]) if spec["mpi"].name == "intel-oneapi-mpi": - mpi = [ - join_path(spec["intel-oneapi-mpi"].libs.directories[0], "libmpi.so") - ] + mpi = [join_path(spec["intel-oneapi-mpi"].libs.directories[0], "libmpi.so")] else: mpi = spec["mpi:cxx"].libs if spec["scalapack"].name == "intel-oneapi-mkl": - mpi_impl = ( - "openmpi" - if spec["mpi"].name in ["openmpi", "hpcx-mpi"] - else "intelmpi" - ) + mpi_impl = "openmpi" if spec["mpi"].name in ["openmpi", "hpcx-mpi"] else "intelmpi" scalapack = [ join_path( spec["intel-oneapi-mkl"].libs.directories[0], @@ -960,9 +920,7 @@ def edit(self, pkg, spec, prefix): if spec.satisfies("^wannier90"): cppflags.append("-D__WANNIER90") - wannier = join_path( - spec["wannier90"].libs.directories[0], "libwannier.a" - ) + wannier = join_path(spec["wannier90"].libs.directories[0], "libwannier.a") libs.append(wannier) gpuver = "" @@ -1031,9 +989,7 @@ def edit(self, pkg, spec, prefix): gpuver = GPU_MAP[spec.variants["amdgpu_target"].value[0]] if spec.satisfies("smm=libsmm"): - lib_dir = join_path( - "lib", self.makefile_architecture, self.makefile_version - ) + lib_dir = join_path("lib", self.makefile_architecture, self.makefile_version) mkdirp(lib_dir) try: copy(env["LIBSMM_PATH"], join_path(lib_dir, "libsmm.a")) @@ -1070,9 +1026,7 @@ def edit(self, pkg, spec, prefix): mkf.write("include {0}\n".format(self.pkg["plumed"].plumed_inc)) mkf.write("\n# COMPILER, LINKER, TOOLS\n\n") - mkf.write( - "FC = {0}\nCC = {1}\nCXX = {2}\nLD = {3}\n".format(fc, cc, cxx, fc) - ) + mkf.write("FC = {0}\nCC = {1}\nCXX = {2}\nLD = {3}\n".format(fc, cc, cxx, fc)) if spec.satisfies("%intel"): intel_bin_dir = ancestor(pkg.compiler.cc) @@ -1168,9 +1122,7 @@ def build_targets(self): @property def makefile(self): - makefile_basename = ".".join( - [self.makefile_architecture, self.makefile_version] - ) + makefile_basename = ".".join([self.makefile_architecture, self.makefile_version]) return join_path("arch", makefile_basename) @property @@ -1212,9 +1164,7 @@ def fix_package_config(self): to generate and override entire libcp2k.pc. """ pkgconfig_file = join_path(self.prefix.lib.pkgconfig, "libcp2k.pc") - filter_file( - r"(^includedir=).*", r"\1{0}".format(self.prefix.include), pkgconfig_file - ) + filter_file(r"(^includedir=).*", r"\1{0}".format(self.prefix.include), pkgconfig_file) filter_file(r"(^libdir=).*", r"\1{0}".format(self.prefix.lib), pkgconfig_file) with open(pkgconfig_file, "r+") as handle: @@ -1225,9 +1175,7 @@ def fix_package_config(self): content += " " + self.spec["fftw-api"].libs.ld_flags fftw = self.spec["fftw-api"] - if fftw.name in ["fftw", "amdfftw", "cray-fftw"] and fftw.satisfies( - "+openmp" - ): + if fftw.name in ["fftw", "amdfftw", "cray-fftw"] and fftw.satisfies("+openmp"): content += " -lfftw3_omp" content += "\n" @@ -1245,9 +1193,7 @@ def cmake_args(self): args += [self.define("CP2K_USE_ACCEL", "OPENCL")] if spec.satisfies("+cuda"): - if (len(spec.variants["cuda_arch"].value) > 1) or spec.satisfies( - "cuda_arch=none" - ): + if (len(spec.variants["cuda_arch"].value) > 1) or spec.satisfies("cuda_arch=none"): raise InstallError("CP2K supports only one cuda_arch at a time.") else: gpu_ver = GPU_MAP[spec.variants["cuda_arch"].value[0]] @@ -1363,9 +1309,7 @@ def cmake_args(self): self.define("CP2K_BLAS_FOUND", True), self.define("CP2K_BLAS_LINK_LIBRARIES", blas.libs.joined(";")), self.define("CP2K_SCALAPACK_FOUND", True), - self.define( - "CP2K_SCALAPACK_INCLUDE_DIRS", spec["scalapack"].prefix.include - ), + self.define("CP2K_SCALAPACK_INCLUDE_DIRS", spec["scalapack"].prefix.include), self.define("CP2K_BLAS_VENDOR", "CUSTOM"), self.define("CP2K_SCALAPACK_VENDOR", "GENERIC"), self.define( diff --git a/repos/spack_repo/builtin/packages/libxs/package.py b/repos/spack_repo/builtin/packages/libxs/package.py index 636cc6f3950..24151da5414 100644 --- a/repos/spack_repo/builtin/packages/libxs/package.py +++ b/repos/spack_repo/builtin/packages/libxs/package.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack_repo.builtin.build_systems.cmake import CMakePackage + from spack.package import * @@ -16,7 +17,9 @@ class Libxs(CMakePackage): maintainers("hfp", "mkrack", "mtaillefumier") homepage = "hhttps://libxs.readthedocs.io/en/latest" - url = "https://github.com/hfp/libxs/archiv/libxs-ab416130f8c9f7edb8c1bf3d3abaf402f61d0fe0.tar.gz" + url = ( + "https://github.com/hfp/libxs/archiv/libxs-ab416130f8c9f7edb8c1bf3d3abaf402f61d0fe0.tar.gz" + ) git = "https://github.com/hfp/libxs.git" license("BSD-3-Clause", checked_by="mkrack") @@ -26,9 +29,7 @@ class Libxs(CMakePackage): variant("fortran", default=False, description="Build Fortran module interface") variant("pic", default=True, description="Build position independent code") - variant( - "shared", default=False, description="Build shared libraries (otherwise static)" - ) + variant("shared", default=False, description="Build shared libraries (otherwise static)") depends_on("cmake@3.13:", type="build") depends_on("c", type="build") From d5d1743d3a626beb1fa7bf0647b4ff6d5c7dc00c Mon Sep 17 00:00:00 2001 From: Mathieu Taillefumier Date: Sun, 7 Jun 2026 14:01:03 +0200 Subject: [PATCH 3/3] REmove upused variable --- repos/spack_repo/builtin/packages/libxs/package.py | 1 - 1 file changed, 1 deletion(-) diff --git a/repos/spack_repo/builtin/packages/libxs/package.py b/repos/spack_repo/builtin/packages/libxs/package.py index 24151da5414..c3ba9f1dd2b 100644 --- a/repos/spack_repo/builtin/packages/libxs/package.py +++ b/repos/spack_repo/builtin/packages/libxs/package.py @@ -39,7 +39,6 @@ class Libxs(CMakePackage): depends_on("libxsmm") def cmake_args(self): - spec = self.spec args = [ self.define_from_variant("LIBXS_FORTRAN", "fortran"), self.define_from_variant("CMAKE_POSITION_INDEPENDENT_CODE", "pic"),