[intel-oneapi-mkl] workaround linking issue for threads=openmp (#42327)

This commit is contained in:
Robert Cohn 2024-01-27 00:22:51 -05:00 committed by GitHub
parent 179a1e423e
commit 1865e228c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 10 deletions

View file

@ -171,8 +171,14 @@ 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}".format(spec["lapack"].libs.search_flags),
"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),
]

View file

@ -179,7 +179,6 @@ def setup_dependent_build_environment(self, env, dependent_spec):
def _find_mkl_libs(self, shared):
libs = []
threading_libs = []
if self.spec.satisfies("+cluster"):
libs.extend([self._xlp64_lib("libmkl_scalapack"), "libmkl_cdft_core"])
@ -192,12 +191,6 @@ def _find_mkl_libs(self, shared):
libs.append("libmkl_intel_thread")
else:
libs.append("libmkl_gnu_thread")
# this is slightly different than what link-line advisor suggests.
# here it uses what the compiler suggests to use to enable openmp,
# instead of being explicit about in which path openmp libraries
# are located (e.g. intel libiomp5, gcc libgomp, clang libomp).
threading_libs += [self.compiler.openmp_flag]
else:
libs.append("libmkl_sequential")
@ -248,8 +241,6 @@ def _find_mkl_libs(self, shared):
except spack.error.NoLibrariesError:
pass
resolved_libs += threading_libs
return resolved_libs
def _xlp64_lib(self, lib):