From 28d25affcc09d5dc2c06b3b11c2edcb3e2b5ff59 Mon Sep 17 00:00:00 2001 From: AMD Toolchain Support <73240730+amd-toolchain-support@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:51:00 +0530 Subject: [PATCH] ELPA: Linking fixes for BLAS and OpenMP (#42747) Co-authored-by: Phil Tooley --- .../repos/builtin/packages/elpa/package.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/var/spack/repos/builtin/packages/elpa/package.py b/var/spack/repos/builtin/packages/elpa/package.py index de04ff9aa2..b682e7c726 100644 --- a/var/spack/repos/builtin/packages/elpa/package.py +++ b/var/spack/repos/builtin/packages/elpa/package.py @@ -176,16 +176,16 @@ def configure_args(self): options += self.enable_or_disable("openmp") - # if using mkl with openmp support, link with openmp - mkl_openmp_flag = ( - self.compiler.openmp_flag - if self.spec.satisfies("^intel-oneapi-mkl threads=openmp") - else "" - ) - options += [ - "LDFLAGS={0} {1}".format(mkl_openmp_flag, spec["lapack"].libs.search_flags), - "LIBS={0} {1}".format(spec["lapack"].libs.link_flags, spec["blas"].libs.link_flags), - ] + # Additional linker search paths and link libs + ldflags = [spec["blas"].libs.search_flags, spec["lapack"].libs.search_flags] + libs = [spec["lapack"].libs.link_flags, spec["blas"].libs.link_flags] + + # If using blas with openmp support, link with openmp + # Needed for Spack-provided OneAPI MKL and for many externals + if self.spec["blas"].satisfies("threads=openmp"): + ldflags.append(self.compiler.openmp_flag) + + options += [f'LDFLAGS={" ".join(ldflags)}', f'LIBS={" ".join(libs)}'] if "+mpi" in self.spec: options += [