summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorMaciej Wójcik <w8jcik@gmail.com>2022-08-08 18:13:31 +0200
committerGitHub <noreply@github.com>2022-08-08 18:13:31 +0200
commitb24a068f3dc562be7f6df9e407185b0a5484bc24 (patch)
treede2b2bbbec18dc869e1a728148c12cf31391648c /var
parent1841e947f66c726d4fcf9239c5eda2c6f8329dec (diff)
downloadspack-b24a068f3dc562be7f6df9e407185b0a5484bc24.tar.gz
spack-b24a068f3dc562be7f6df9e407185b0a5484bc24.tar.bz2
spack-b24a068f3dc562be7f6df9e407185b0a5484bc24.tar.xz
spack-b24a068f3dc562be7f6df9e407185b0a5484bc24.zip
gromacs: add CP2K (#31836)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/cp2k/package.py39
-rw-r--r--var/spack/repos/builtin/packages/dbcsr/package.py12
-rw-r--r--var/spack/repos/builtin/packages/gromacs/package.py23
3 files changed, 70 insertions, 4 deletions
diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py
index b62e0c8450..fcfd8ad3d6 100644
--- a/var/spack/repos/builtin/packages/cp2k/package.py
+++ b/var/spack/repos/builtin/packages/cp2k/package.py
@@ -23,6 +23,7 @@ class Cp2k(MakefilePackage, CudaPackage):
maintainers = ["dev-zero"]
+ version("2022.1", sha256="2c34f1a7972973c62d471cd35856f444f11ab22f2ff930f6ead20f3454fd228b")
version("9.1", sha256="fedb4c684a98ad857cd49b69a3ae51a73f85a9c36e9cb63e3b02320c74454ce6")
version("8.2", sha256="2e24768720efed1a5a4a58e83e2aca502cd8b95544c21695eb0de71ed652f20a")
version("8.1", sha256="7f37aead120730234a60b2989d0547ae5e5498d93b1e9b5eb548c041ee8e7772")
@@ -732,10 +733,48 @@ class Cp2k(MakefilePackage, CudaPackage):
with spack.util.environment.set_env(PWD=self.build_directory):
super(Cp2k, self).build(spec, prefix)
+ with working_dir(self.build_directory):
+ make("libcp2k", *self.build_targets)
+
def install(self, spec, prefix):
exe_dir = join_path("exe", self.makefile_architecture)
+ lib_dir = join_path("lib", self.makefile_architecture, self.makefile_version)
+
install_tree(exe_dir, self.prefix.bin)
install_tree("data", self.prefix.share.data)
+ install_tree(lib_dir, self.prefix.lib)
+
+ mkdirp(self.prefix.include)
+ install("src/start/libcp2k.h", join_path(self.prefix.include, "libcp2k.h"))
+
+ @run_after("install")
+ def fix_package_config(self):
+ """
+ Default build procedure generates libcp2k.pc with invalid paths,
+ because they are collected from temporary directory.
+
+ Ignoring invalid paths, most library-related switches are correct
+ except for fftw and openblas.
+
+ This procedure is appending two missing switches (tested with GROMACS 2022.2 + CP2K).
+
+ In case such approach causes issues in the future, it might be necessary
+ to generate and override entire libcp2k.pc.
+ """
+ with open(join_path(self.prefix.lib.pkgconfig, "libcp2k.pc"), "r+") as handle:
+ content = handle.read().rstrip()
+
+ content += " " + self.spec["blas"].libs.ld_flags
+ content += " " + self.spec["lapack"].libs.ld_flags
+ content += " " + self.spec["fftw-api"].libs.ld_flags
+
+ if "^fftw+openmp" in self.spec:
+ content += " -lfftw3_omp"
+
+ content += "\n"
+
+ handle.seek(0)
+ handle.write(content)
def check(self):
data_dir = join_path(self.stage.source_path, "data")
diff --git a/var/spack/repos/builtin/packages/dbcsr/package.py b/var/spack/repos/builtin/packages/dbcsr/package.py
index 1b63fcdeb7..2b6ad2da91 100644
--- a/var/spack/repos/builtin/packages/dbcsr/package.py
+++ b/var/spack/repos/builtin/packages/dbcsr/package.py
@@ -17,6 +17,7 @@ class Dbcsr(CMakePackage, CudaPackage, ROCmPackage):
maintainers = ["dev-zero"]
version("develop", branch="develop")
+ version("2.3.0", sha256="f750de586cffa66852b646f7f85eb831eeb64fa2d25ce50ed10e1df016dd3364")
version("2.2.0", sha256="245b0382ddc7b80f85af8288f75bd03d56ec51cdfb6968acb4931529b35173ec")
version("2.1.0", sha256="9e58fd998f224632f356e479d18b5032570d00d87b86736b6a6ac2d03f8d4b3c")
version("2.0.1", sha256="61d5531b661e1dab043353a1d67939ddcde3893d3dc7b0ab3d05074d448b485c")
@@ -114,20 +115,23 @@ class Dbcsr(CMakePackage, CudaPackage, ROCmPackage):
]
# Switch necessary as a result of a bug.
- # In version 2.0, this switch doesn't exist yet.
- # The issue should be already fixed in 2.3 (not released yet).
if "@2.1:2.2" in spec:
args += ["-DBUILD_TESTING=ON"]
if self.spec.satisfies("+cuda"):
cuda_arch = self.spec.variants["cuda_arch"].value[0]
- gpuver = {
+ gpu_map = {
"35": "K40",
"37": "K80",
"60": "P100",
"70": "V100",
- }[cuda_arch]
+ }
+
+ if "@2.3:" in spec:
+ gpu_map["80"] = "A100"
+
+ gpuver = gpu_map[cuda_arch]
if cuda_arch == "35" and self.spec.satisfies("+cuda_arch_35_k20x"):
gpuver = "K20X"
diff --git a/var/spack/repos/builtin/packages/gromacs/package.py b/var/spack/repos/builtin/packages/gromacs/package.py
index 0fd699278a..ed2f58d660 100644
--- a/var/spack/repos/builtin/packages/gromacs/package.py
+++ b/var/spack/repos/builtin/packages/gromacs/package.py
@@ -124,6 +124,22 @@ class Gromacs(CMakePackage):
variant("blas", default=False, description="Enables an external BLAS library")
variant("cycle_subcounters", default=False, description="Enables cycle subcounters")
+ variant("cp2k", default=False, description="CP2K QM/MM interface integration")
+ conflicts(
+ "+cp2k", when="@:2021", msg="CP2K QM/MM support have been introduced in GROMACS 2022"
+ )
+ conflicts("+shared", when="+cp2k", msg="Enabling CP2K requires static build")
+ conflicts(
+ "~lapack",
+ when="+cp2k",
+ msg="GROMACS and CP2K should use the same lapack, please disable bundled lapack",
+ )
+ conflicts(
+ "~blas",
+ when="+cp2k",
+ msg="GROMACS and CP2K should use the same blas, please disable bundled blas",
+ )
+
depends_on("mpi", when="+mpi")
# Plumed 2.8.0 needs Gromacs 2021.4, 2020.6, 2019.6
@@ -198,6 +214,9 @@ class Gromacs(CMakePackage):
depends_on("hwloc@1.0:1", when="+hwloc@2016:2018")
depends_on("hwloc", when="+hwloc@2019:")
+ depends_on("cp2k@8.1:", when="+cp2k")
+ depends_on("dbcsr", when="+cp2k")
+
patch("gmxDetectCpu-cmake-3.14.patch", when="@2018:2019.3^cmake@3.14.0:")
patch("gmxDetectSimd-cmake-3.14.patch", when="@5.0:2017^cmake@3.14.0:")
@@ -374,6 +393,10 @@ class Gromacs(CMakePackage):
else:
options.append("-DGMX_EXTERNAL_BLAS:BOOL=OFF")
+ if "+cp2k" in self.spec:
+ options.append("-DGMX_CP2K:BOOL=ON")
+ options.append("-DCP2K_DIR:STRING={0}".format(self.spec["cp2k"].prefix))
+
# Activate SIMD based on properties of the target
target = self.spec.target
if target >= "zen2":