summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorBrian Van Essen <vanessen1@llnl.gov>2023-12-07 13:06:07 -0600
committerGitHub <noreply@github.com>2023-12-07 11:06:07 -0800
commit9f1223e7a35fb2a6565b493fcce41e013ee3be1f (patch)
treedcc439e700e27dee378f05f645e1f061eacb446d /var
parent5beef2844483aa784c3532f460c21ad1bb021542 (diff)
downloadspack-9f1223e7a35fb2a6565b493fcce41e013ee3be1f.tar.gz
spack-9f1223e7a35fb2a6565b493fcce41e013ee3be1f.tar.bz2
spack-9f1223e7a35fb2a6565b493fcce41e013ee3be1f.tar.xz
spack-9f1223e7a35fb2a6565b493fcce41e013ee3be1f.zip
Bugfix spectrum-mpi module generation (#41466)
* Ensure that additional environment variables are set when a module file is generated. * Fixed the detection of the opal_prefix / MPI_ROOT field to use ompi_info. --------- Co-authored-by: Greg Becker <becker33@llnl.gov>
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/spectrum-mpi/package.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/var/spack/repos/builtin/packages/spectrum-mpi/package.py b/var/spack/repos/builtin/packages/spectrum-mpi/package.py
index ea5c29d322..8b4efee5ff 100644
--- a/var/spack/repos/builtin/packages/spectrum-mpi/package.py
+++ b/var/spack/repos/builtin/packages/spectrum-mpi/package.py
@@ -56,6 +56,14 @@ class SpectrumMpi(BundlePackage):
break
return actual_compiler.spec if actual_compiler else None
+ def get_opal_prefix(exe):
+ output = Executable(exe)(output=str, error=str)
+ match = re.search(r"Prefix: (\S+)", output)
+ if not match:
+ return None
+ opal_prefix = match.group(1)
+ return opal_prefix
+
results = []
for exe in exes:
dirname = os.path.dirname(exe)
@@ -83,9 +91,14 @@ class SpectrumMpi(BundlePackage):
# results.append((variant, {'compilers': compilers_found}))
#
# Otherwise, use this simpler attribute
- results.append(variant)
else:
- results.append("")
+ variant = ""
+ opal_prefix = get_opal_prefix(exe)
+ if opal_prefix:
+ extra_attributes = {"opal_prefix": opal_prefix}
+ results.append((variant, extra_attributes))
+ else:
+ results.append(variant)
return results
def setup_dependent_package(self, module, dependent_spec):
@@ -148,3 +161,6 @@ class SpectrumMpi(BundlePackage):
env.set("MPICXX", os.path.join(self.prefix.bin, "mpic++"))
env.set("MPIF77", os.path.join(self.prefix.bin, "mpif77"))
env.set("MPIF90", os.path.join(self.prefix.bin, "mpif90"))
+
+ env.set("OPAL_PREFIX", self.spec.extra_attributes.get("opal_prefix", self.prefix))
+ env.set("MPI_ROOT", self.spec.extra_attributes.get("opal_prefix", self.prefix))