Update CP2K recipe for AOCC compiler (#46985)

This commit is contained in:
AMD Toolchain Support 2024-10-16 20:18:24 +05:30 committed by GitHub
parent cbdc07248f
commit b573ec3920
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -188,9 +188,10 @@ 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}")
# AOCC only works with libint@2.6.0
depends_on(
"libint@2.6.0:+fortran tune=cp2k-lmax-{0}".format(lmax),
when="@7.0: lmax={0}".format(lmax),
f"libint@=2.6.0+fortran tune=cp2k-lmax-{lmax}", when=f"@7.0: lmax={lmax} %aocc"
)
with when("+libxc"):
@ -305,6 +306,9 @@ class Cp2k(MakefilePackage, CMakePackage, CudaPackage, ROCmPackage):
depends_on("hipblas")
depends_on("hipfft")
# The CMake build system and AOCC are not compatible as of AOCC 5
requires("build_system=makefile", when="%aocc")
# CP2K needs compiler specific compilation flags, e.g. optflags
conflicts("%apple-clang")
conflicts("%clang")
@ -827,6 +831,12 @@ def fflags(var, lst):
if spec.satisfies("%intel"):
mkf.write(fflags("LDFLAGS_C", ldflags + ["-nofor-main"]))
if spec.satisfies("%aocc@5:"):
# ensure C based applications can be build properly
mkf.write(fflags("LDFLAGS_C", ldflags + ["-fno-fortran-main"]))
# This flag is required for the correct runtime behaviour of the code with aocc@5.0
mkf.write(fflags("FCFLAGS", fcflags + ["-mllvm -enable-newgvn=true"]))
mkf.write("# CP2K-specific flags\n\n")
mkf.write("GPUVER = {0}\n".format(gpuver))
mkf.write("DATA_DIR = {0}\n".format(prefix.share.data))