[intel-oneapi-mkl] add openmpi support for +cluster (#38554)
This commit is contained in:
parent
43143b134a
commit
0c2b98ca70
1 changed files with 20 additions and 11 deletions
|
@ -125,7 +125,7 @@ def headers(self):
|
|||
|
||||
@property
|
||||
def libs(self):
|
||||
shared = "+shared" in self.spec
|
||||
shared = self.spec.satisfies("+shared")
|
||||
|
||||
libs = self._find_mkl_libs(shared)
|
||||
|
||||
|
@ -145,28 +145,27 @@ def setup_run_environment(self, env):
|
|||
# flags too. We prefer the __INTEL_POST_CFLAGS/__INTEL_POST_FFLAGS flags over
|
||||
# the PRE ones so that any other RPATHs provided by the users on the command
|
||||
# line come before and take precedence over the ones we inject here.
|
||||
for d in self._find_mkl_libs("+shared" in self.spec).directories:
|
||||
for d in self._find_mkl_libs(self.spec.satisfies("+shared")).directories:
|
||||
flag = "-Wl,-rpath,{0}".format(d)
|
||||
env.append_path("__INTEL_POST_CFLAGS", flag, separator=" ")
|
||||
env.append_path("__INTEL_POST_FFLAGS", flag, separator=" ")
|
||||
|
||||
def setup_dependent_build_environment(self, env, dependent_spec):
|
||||
# Only if environment modifications are desired (default is +envmods)
|
||||
if "+envmods" in self.spec:
|
||||
if self.spec.satisfies("+envmods"):
|
||||
env.set("MKLROOT", self.component_prefix)
|
||||
env.append_path("PKG_CONFIG_PATH", self.component_prefix.lib.pkgconfig)
|
||||
|
||||
def _find_mkl_libs(self, shared):
|
||||
libs = []
|
||||
|
||||
if "+cluster" in self.spec:
|
||||
if self.spec.satisfies("+cluster"):
|
||||
libs.extend([self._xlp64_lib("libmkl_scalapack"), "libmkl_cdft_core"])
|
||||
|
||||
libs.append(self._xlp64_lib("libmkl_intel"))
|
||||
|
||||
if "threads=tbb" in self.spec:
|
||||
if self.spec.satisfies("threads=tbb"):
|
||||
libs.append("libmkl_tbb_thread")
|
||||
elif "threads=openmp" in self.spec:
|
||||
elif self.spec.satisfies("threads=openmp"):
|
||||
if self.spec.satisfies("%oneapi") or self.spec.satisfies("%intel"):
|
||||
libs.append("libmkl_intel_thread")
|
||||
else:
|
||||
|
@ -176,8 +175,18 @@ def _find_mkl_libs(self, shared):
|
|||
|
||||
libs.append("libmkl_core")
|
||||
|
||||
if "+cluster" in self.spec:
|
||||
libs.append(self._xlp64_lib("libmkl_blacs_intelmpi"))
|
||||
if self.spec.satisfies("+cluster"):
|
||||
if any(self.spec.satisfies(m) for m in ["^intel-oneapi-mpi", "^intel-mpi", "^mpich"]):
|
||||
libs.append(self._xlp64_lib("libmkl_blacs_intelmpi"))
|
||||
elif self.spec.satisfies("^openmpi"):
|
||||
libs.append(self._xlp64_lib("libmkl_blacs_openmpi"))
|
||||
else:
|
||||
raise RuntimeError(
|
||||
(
|
||||
"intel-oneapi-mpi +cluster requires one of "
|
||||
"^intel-oneapi-mpi, ^intel-mpi, ^mpich, or ^openmpi"
|
||||
)
|
||||
)
|
||||
|
||||
lib_path = self.component_prefix.lib.intel64
|
||||
lib_path = lib_path if isdir(lib_path) else dirname(lib_path)
|
||||
|
@ -186,12 +195,12 @@ def _find_mkl_libs(self, shared):
|
|||
# Add MPI libraries for cluster support. If MPI is not in the
|
||||
# spec, then MKL is externally installed and application must
|
||||
# link with MPI libaries
|
||||
if "+cluster" in self.spec and "mpi" in self.spec:
|
||||
if self.spec.satisfies("+cluster ^mpi"):
|
||||
resolved_libs = resolved_libs + self.spec["mpi"].libs
|
||||
return resolved_libs
|
||||
|
||||
def _xlp64_lib(self, lib):
|
||||
return lib + ("_ilp64" if "+ilp64" in self.spec else "_lp64")
|
||||
return lib + ("_ilp64" if self.spec.satisfies("+ilp64") else "_lp64")
|
||||
|
||||
@run_after("install")
|
||||
def fixup_prefix(self):
|
||||
|
|
Loading…
Reference in a new issue