cp2k: add v2022.2, update CUDA settings (#34757)

This commit is contained in:
Glenn Johnson 2023-01-16 07:13:40 -06:00 committed by GitHub
parent d0866e4d02
commit 645faad379
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,7 @@ class Cp2k(MakefilePackage, CudaPackage):
maintainers = ["dev-zero"]
version("2022.2", sha256="1a473dea512fe264bb45419f83de432d441f90404f829d89cbc3a03f723b8354")
version("2022.1", sha256="2c34f1a7972973c62d471cd35856f444f11ab22f2ff930f6ead20f3454fd228b")
version("9.1", sha256="fedb4c684a98ad857cd49b69a3ae51a73f85a9c36e9cb63e3b02320c74454ce6")
version("8.2", sha256="2e24768720efed1a5a4a58e83e2aca502cd8b95544c21695eb0de71ed652f20a")
@ -242,6 +243,10 @@ class Cp2k(MakefilePackage, CudaPackage):
when="@8.2",
)
def url_for_version(self, version):
url = "https://github.com/cp2k/cp2k/releases/download/v{0}/cp2k-{0}.tar.bz2"
return url.format(version)
@property
def makefile_architecture(self):
return "{0.architecture}-{0.compiler.name}".format(self.spec)
@ -569,6 +574,9 @@ def edit(self, spec, prefix):
]
if spec.satisfies("@9:"):
if spec.satisfies("@2022:"):
cppflags += ["-D__OFFLOAD_CUDA"]
acc_compiler_var = "OFFLOAD_CC"
acc_flags_var = "OFFLOAD_FLAGS"
cppflags += [
@ -577,6 +585,15 @@ def edit(self, spec, prefix):
"-DOFFLOAD_TARGET=cuda",
]
libs += ["-lcublas"]
if spec.satisfies("+cuda_fft"):
if spec.satisfies("@:9"):
cppflags += ["-D__PW_CUDA"]
libs += ["-lcufft"]
else:
if spec.satisfies("@2022:"):
cppflags += ["-D__NO_OFFLOAD_PW"]
else:
acc_compiler_var = "NVCC"
acc_flags_var = "NVFLAGS"
@ -762,7 +779,11 @@ def fix_package_config(self):
to generate and override entire libcp2k.pc.
"""
if self.spec.satisfies("@9.1:"):
with open(join_path(self.prefix.lib.pkgconfig, "libcp2k.pc"), "r+") as handle:
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"(^libdir=).*", r"\1{0}".format(self.prefix.lib), pkgconfig_file)
with open(pkgconfig_file, "r+") as handle:
content = handle.read().rstrip()
content += " " + self.spec["blas"].libs.ld_flags