diff options
author | Harmen Stoppels <me@harmenstoppels.nl> | 2024-11-11 23:14:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-11 14:14:38 -0800 |
commit | 786f8dfcce92a9464f988478f27743c7dbec27f7 (patch) | |
tree | e7c5f6e271dc6888eac94175802a632abb34a5a7 | |
parent | 4691301eba3747e1e488034f114cf06946420da4 (diff) | |
download | spack-786f8dfcce92a9464f988478f27743c7dbec27f7.tar.gz spack-786f8dfcce92a9464f988478f27743c7dbec27f7.tar.bz2 spack-786f8dfcce92a9464f988478f27743c7dbec27f7.tar.xz spack-786f8dfcce92a9464f988478f27743c7dbec27f7.zip |
openmpi: fix detection (#47541)
Take a simpler approach to listing variant options -- store them in variables instead of trying to
roundtrip them through metadata dictionaries.
-rw-r--r-- | var/spack/repos/builtin/packages/openmpi/package.py | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index 58105a90f7..c82e58cfba 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -452,33 +452,34 @@ class Openmpi(AutotoolsPackage, CudaPackage): patch("pmix_getline_pmix_version.patch", when="@5.0.0:5.0.3") patch("pmix_getline_pmix_version-prte.patch", when="@5.0.3") + FABRICS = ( + "psm", + "psm2", + "verbs", + "mxm", + "ucx", + "ofi", + "fca", + "hcoll", + "ucc", + "xpmem", + "cma", + "knem", + ) + variant( "fabrics", values=disjoint_sets( - ("auto",), - ( - "psm", - "psm2", - "verbs", - "mxm", - "ucx", - "ofi", - "fca", - "hcoll", - "ucc", - "xpmem", - "cma", - "knem", - ), # shared memory transports + ("auto",), FABRICS # shared memory transports ).with_non_feature_values("auto", "none"), description="List of fabrics that are enabled; " "'auto' lets openmpi determine", ) + SCHEDULERS = ("alps", "lsf", "tm", "slurm", "sge", "loadleveler") + variant( "schedulers", - values=disjoint_sets( - ("auto",), ("alps", "lsf", "tm", "slurm", "sge", "loadleveler") - ).with_non_feature_values("auto", "none"), + values=disjoint_sets(("auto",), SCHEDULERS).with_non_feature_values("auto", "none"), description="List of schedulers for which support is enabled; " "'auto' lets openmpi determine", ) @@ -806,24 +807,26 @@ class Openmpi(AutotoolsPackage, CudaPackage): variants.append("~pmi") # fabrics - fabrics = get_options_from_variant(cls, "fabrics") used_fabrics = [] - for fabric in fabrics: + for fabric in cls.FABRICS: match = re.search(r"\bMCA (?:mtl|btl|pml): %s\b" % fabric, output) if match: used_fabrics.append(fabric) if used_fabrics: variants.append("fabrics=" + ",".join(used_fabrics)) + else: + variants.append("fabrics=none") # schedulers - schedulers = get_options_from_variant(cls, "schedulers") used_schedulers = [] - for scheduler in schedulers: + for scheduler in cls.SCHEDULERS: match = re.search(r"\bMCA (?:prrte|ras): %s\b" % scheduler, output) if match: used_schedulers.append(scheduler) if used_schedulers: variants.append("schedulers=" + ",".join(used_schedulers)) + else: + variants.append("schedulers=none") # Get the appropriate compiler match = re.search(r"\bC compiler absolute: (\S+)", output) @@ -1412,12 +1415,3 @@ def is_enabled(text): if text in set(["t", "true", "enabled", "yes", "1"]): return True return False - - -# This code gets all the fabric names from the variants list -# Idea taken from the AutotoolsPackage source. -def get_options_from_variant(self, name): - values = self.variants[name][0].values - if getattr(values, "feature_values", None): - values = values.feature_values - return values |