CP2K package: various AOCC compatibility fixes (#39773)
* cp2k: patch several old versions to help newer compilers * cp2k: use -O2 optimization for AOCC compiler * cp2k: do not support old AOCC compilers * cp2k: simplify when clause due to conflicting out old compilers * cp2k: give a more meaningful message for confilcts Co-authored-by: Ning Li <ning.li@amd.com> Co-authored-by: Phil Tooley <phil.tooley@amd.com>
This commit is contained in:
parent
0696497ffa
commit
845973273a
3 changed files with 75 additions and 2 deletions
|
@ -0,0 +1,21 @@
|
|||
diff -Naru a/src/qs_kpp1_env_methods.F b/src/qs_kpp1_env_methods.F
|
||||
--- a/src/qs_kpp1_env_methods.F 2022-10-03 01:14:25.720416300 +0530
|
||||
+++ b/src/qs_kpp1_env_methods.F 2023-06-14 02:33:05.205287205 +0530
|
||||
@@ -214,7 +214,6 @@
|
||||
output_unit
|
||||
LOGICAL :: gapw, gapw_xc, lsd, my_calc_forces
|
||||
REAL(KIND=dp) :: alpha, energy_hartree, energy_hartree_1c
|
||||
- REAL(KIND=dp), DIMENSION(:, :, :, :), POINTER :: vxg
|
||||
TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
|
||||
TYPE(cp_logger_type), POINTER :: logger
|
||||
TYPE(cp_para_env_type), POINTER :: para_env
|
||||
@@ -373,7 +372,8 @@
|
||||
|
||||
CALL xc_calc_2nd_deriv(v_xc, v_xc_tau, p_env%kpp1_env%deriv_set, p_env%kpp1_env%rho_set, &
|
||||
rho1_r_pw, rho1_g_pw, tau1_r_pw, auxbas_pw_pool, xc_section, .FALSE., &
|
||||
- NULL(vxg), lsd_singlets, do_excitations, do_triplet, do_tddft, &
|
||||
+ lsd_singlets=lsd_singlets, do_excitations=do_excitations, &
|
||||
+ do_triplet=do_triplet, do_tddft=do_tddft, &
|
||||
compute_virial=calc_virial, virial_xc=virial)
|
||||
|
||||
DO ispin = 1, nspins
|
|
@ -0,0 +1,21 @@
|
|||
diff -Naru a/src/qs_kpp1_env_methods.F b/src/qs_kpp1_env_methods.F
|
||||
--- a/src/qs_kpp1_env_methods.F 2021-11-20 14:35:36.103103400 +0530
|
||||
+++ b/src/qs_kpp1_env_methods.F 2023-06-14 12:00:52.350584708 +0530
|
||||
@@ -220,7 +220,6 @@
|
||||
output_unit
|
||||
LOGICAL :: gapw, gapw_xc, lsd, my_calc_forces
|
||||
REAL(KIND=dp) :: alpha, energy_hartree, energy_hartree_1c
|
||||
- REAL(KIND=dp), DIMENSION(:, :, :, :), POINTER :: vxg
|
||||
TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
|
||||
TYPE(cp_logger_type), POINTER :: logger
|
||||
TYPE(cp_para_env_type), POINTER :: para_env
|
||||
@@ -361,7 +360,8 @@
|
||||
|
||||
CALL xc_calc_2nd_deriv(v_xc, p_env%kpp1_env%deriv_set, p_env%kpp1_env%rho_set, &
|
||||
rho1_r_pw, rho1_g_pw, auxbas_pw_pool, xc_section, .FALSE., &
|
||||
- NULL(vxg), lsd_singlets, do_excitations, do_triplet, do_tddft, &
|
||||
+ lsd_singlets=lsd_singlets, do_excitations=do_excitations, &
|
||||
+ do_triplet=do_triplet, do_tddft=do_tddft, &
|
||||
compute_virial=calc_virial, virial_xc=virial)
|
||||
|
||||
DO ispin = 1, nspins
|
|
@ -282,6 +282,10 @@ class Cp2k(MakefilePackage, CudaPackage, CMakePackage, ROCmPackage):
|
|||
conflicts("%apple-clang")
|
||||
conflicts("%clang")
|
||||
conflicts("%nag")
|
||||
conflicts(
|
||||
"%aocc@:3.2",
|
||||
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+")
|
||||
|
||||
|
@ -327,7 +331,32 @@ class Cp2k(MakefilePackage, CudaPackage, CMakePackage, ROCmPackage):
|
|||
sha256="3617abb877812c4b933f601438c70f95e21c6161bea177277b1d4125fd1c0bf9",
|
||||
when="@8.2",
|
||||
)
|
||||
patch("posix_c_source.patch", when="%aocc")
|
||||
|
||||
# Patch for compilers with stricter C99 checks
|
||||
patch("posix_c_source.patch", when="@7.1%aocc@4.0:")
|
||||
patch("posix_c_source.patch", when="@7.1%gcc@13:")
|
||||
|
||||
# Fix missing variable in OpenMP private clause
|
||||
patch(
|
||||
"https://github.com/cp2k/cp2k/commit/be86bd7f6cd6af7d68f8957dcdb67e7c3d586741.patch?full_index=1",
|
||||
sha256="1bb5a8e80603684a743e7821d24d41b31b60ccbb7d4257df1d2da53a3630e5bf",
|
||||
when="@2022.1:2022.2",
|
||||
)
|
||||
|
||||
# Avoid using NULL() as subroutine argument as doing so breaks some versions of AOCC compiler
|
||||
# These patches backport 2023.x fixes to previous versions
|
||||
patch("backport_avoid_null_2022.x.patch", when="@2022.1:2022.2 %aocc@:4.0")
|
||||
patch("backport_avoid_null_9.1.patch", when="@9.1 %aocc@:4.0")
|
||||
|
||||
# Patch for an undefined constant due to incompatible changes in ELPA
|
||||
@when("@9.1:2022.2 +elpa")
|
||||
def patch(self):
|
||||
if self.spec["elpa"].satisfies("@2022.05.001:"):
|
||||
filter_file(
|
||||
r"ELPA_2STAGE_REAL_INTEL_GPU",
|
||||
"ELPA_2STAGE_REAL_INTEL_GPU_SYCL",
|
||||
"src/fm/cp_fm_elpa.F",
|
||||
)
|
||||
|
||||
def url_for_version(self, version):
|
||||
url = "https://github.com/cp2k/cp2k/releases/download/v{0}/cp2k-{0}.tar.bz2"
|
||||
|
@ -372,7 +401,7 @@ def edit(self, spec, prefix):
|
|||
"nvhpc": ["-fast"],
|
||||
"cce": ["-O2"],
|
||||
"xl": ["-O3"],
|
||||
"aocc": ["-O1"],
|
||||
"aocc": ["-O2"],
|
||||
}
|
||||
|
||||
dflags = ["-DNDEBUG"]
|
||||
|
@ -421,6 +450,8 @@ def edit(self, spec, prefix):
|
|||
fcflags += [
|
||||
"-fallow-argument-mismatch"
|
||||
] # https://github.com/pmodels/mpich/issues/4300
|
||||
if spec.satisfies("@7.1%gcc@13:"):
|
||||
fcflags.append("-fallow-argument-mismatch")
|
||||
|
||||
if "+openmp" in spec:
|
||||
cflags.append(self.compiler.openmp_flag)
|
||||
|
|
Loading…
Reference in a new issue