From c6faab10aab0bc833c2df24cb3a60c0f40bced2e Mon Sep 17 00:00:00 2001 From: AMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com> Date: Mon, 19 Feb 2024 15:51:11 +0530 Subject: [PATCH] CP2K: fix multiple use of spec["fftw"] (#42724) fftw object was originally created with spec["fftw:openmp"], but referencing spec["fftw"] overwrites the 'last_query' in the spec object, so later use of fftw.libs was not returing FFTW OpenMP libs. Also allow the post-install fixup to support amdfftw as well as fftw. Co-authored-by: Branden Moore Co-authored-by: Phil Tooley Co-authored-by: Greg Becker --- var/spack/repos/builtin/packages/cp2k/package.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index ea01e433eb..8e62699904 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -384,7 +384,7 @@ def edit(self, pkg, spec, prefix): } dflags = ["-DNDEBUG"] if spec.satisfies("@:2023.2") else [] - if spec["fftw-api"].name in ("intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"): + if fftw.name in ("intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"): cppflags = ["-D__FFTW3_MKL", "-I{0}".format(fftw_header_dir)] else: cppflags = ["-D__FFTW3", "-I{0}".format(fftw_header_dir)] @@ -888,7 +888,8 @@ def fix_package_config(self): content += " " + self.spec["lapack"].libs.ld_flags content += " " + self.spec["fftw-api"].libs.ld_flags - if (self.spec["fftw-api"].name == "fftw") and ("+openmp" in self.spec["fftw"]): + fftw = self.spec["fftw-api"] + if fftw.name in ["fftw", "amdfftw"] and fftw.satisfies("+openmp"): content += " -lfftw3_omp" content += "\n"