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.
This commit is contained in:
Harmen Stoppels 2024-11-11 23:14:38 +01:00 committed by GitHub
parent 4691301eba
commit 786f8dfcce
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.patch", when="@5.0.0:5.0.3")
patch("pmix_getline_pmix_version-prte.patch", when="@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( variant(
"fabrics", "fabrics",
values=disjoint_sets( values=disjoint_sets(
("auto",), ("auto",), FABRICS # shared memory transports
(
"psm",
"psm2",
"verbs",
"mxm",
"ucx",
"ofi",
"fca",
"hcoll",
"ucc",
"xpmem",
"cma",
"knem",
), # shared memory transports
).with_non_feature_values("auto", "none"), ).with_non_feature_values("auto", "none"),
description="List of fabrics that are enabled; " "'auto' lets openmpi determine", description="List of fabrics that are enabled; " "'auto' lets openmpi determine",
) )
SCHEDULERS = ("alps", "lsf", "tm", "slurm", "sge", "loadleveler")
variant( variant(
"schedulers", "schedulers",
values=disjoint_sets( values=disjoint_sets(("auto",), SCHEDULERS).with_non_feature_values("auto", "none"),
("auto",), ("alps", "lsf", "tm", "slurm", "sge", "loadleveler")
).with_non_feature_values("auto", "none"),
description="List of schedulers for which support is enabled; " description="List of schedulers for which support is enabled; "
"'auto' lets openmpi determine", "'auto' lets openmpi determine",
) )
@ -806,24 +807,26 @@ def determine_variants(cls, exes, version):
variants.append("~pmi") variants.append("~pmi")
# fabrics # fabrics
fabrics = get_options_from_variant(cls, "fabrics")
used_fabrics = [] used_fabrics = []
for fabric in fabrics: for fabric in cls.FABRICS:
match = re.search(r"\bMCA (?:mtl|btl|pml): %s\b" % fabric, output) match = re.search(r"\bMCA (?:mtl|btl|pml): %s\b" % fabric, output)
if match: if match:
used_fabrics.append(fabric) used_fabrics.append(fabric)
if used_fabrics: if used_fabrics:
variants.append("fabrics=" + ",".join(used_fabrics)) variants.append("fabrics=" + ",".join(used_fabrics))
else:
variants.append("fabrics=none")
# schedulers # schedulers
schedulers = get_options_from_variant(cls, "schedulers")
used_schedulers = [] used_schedulers = []
for scheduler in schedulers: for scheduler in cls.SCHEDULERS:
match = re.search(r"\bMCA (?:prrte|ras): %s\b" % scheduler, output) match = re.search(r"\bMCA (?:prrte|ras): %s\b" % scheduler, output)
if match: if match:
used_schedulers.append(scheduler) used_schedulers.append(scheduler)
if used_schedulers: if used_schedulers:
variants.append("schedulers=" + ",".join(used_schedulers)) variants.append("schedulers=" + ",".join(used_schedulers))
else:
variants.append("schedulers=none")
# Get the appropriate compiler # Get the appropriate compiler
match = re.search(r"\bC compiler absolute: (\S+)", output) 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"]): if text in set(["t", "true", "enabled", "yes", "1"]):
return True return True
return False 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