summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com>2024-10-16 20:18:24 +0530
committerGitHub <noreply@github.com>2024-10-16 16:48:24 +0200
commitb573ec39201b8c66cdc888ee2912ea7ade94fe18 (patch)
tree923c7fcdebca294fad416dc7a26147b7f0c2754f
parentcbdc07248f517e5d8f8e56f5e59359794bda6757 (diff)
downloadspack-b573ec39201b8c66cdc888ee2912ea7ade94fe18.tar.gz
spack-b573ec39201b8c66cdc888ee2912ea7ade94fe18.tar.bz2
spack-b573ec39201b8c66cdc888ee2912ea7ade94fe18.tar.xz
spack-b573ec39201b8c66cdc888ee2912ea7ade94fe18.zip
Update CP2K recipe for AOCC compiler (#46985)
-rw-r--r--var/spack/repos/builtin/packages/cp2k/package.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py
index 306cb55813..0a590013b1 100644
--- a/var/spack/repos/builtin/packages/cp2k/package.py
+++ b/var/spack/repos/builtin/packages/cp2k/package.py
@@ -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 @@ class MakefileBuilder(makefile.MakefileBuilder):
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))