libfabric can now find external installation (#33796)
* Added support for libfabric to find an external installation and identify variants supported. * Change the fabrics definition to only include CXI when on a cray system with a libfabric-based slingshot network. * Added a conflict when trying to build the CXI fabric value since it is only available as closed source at this time.
This commit is contained in:
parent
92b7f63365
commit
68ce49a57b
@ -3,6 +3,10 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
||||||
|
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
|
||||||
|
import spack.platforms.cray
|
||||||
from spack.package import *
|
from spack.package import *
|
||||||
|
|
||||||
|
|
||||||
@ -15,6 +19,8 @@ class Libfabric(AutotoolsPackage):
|
|||||||
git = "https://github.com/ofiwg/libfabric.git"
|
git = "https://github.com/ofiwg/libfabric.git"
|
||||||
maintainers = ["rajachan"]
|
maintainers = ["rajachan"]
|
||||||
|
|
||||||
|
executables = ["^fi_info$"]
|
||||||
|
|
||||||
version("main", branch="main")
|
version("main", branch="main")
|
||||||
version("1.16.1", sha256="53f992d33f9afe94b8a4ea3d105504887f4311cf4b68cea99a24a85fcc39193f")
|
version("1.16.1", sha256="53f992d33f9afe94b8a4ea3d105504887f4311cf4b68cea99a24a85fcc39193f")
|
||||||
version("1.15.1", sha256="cafa3005a9dc86064de179b0af4798ad30b46b2f862fe0268db03d13943e10cd")
|
version("1.15.1", sha256="cafa3005a9dc86064de179b0af4798ad30b46b2f862fe0268db03d13943e10cd")
|
||||||
@ -44,6 +50,7 @@ class Libfabric(AutotoolsPackage):
|
|||||||
version("1.4.2", sha256="5d027d7e4e34cb62508803e51d6bd2f477932ad68948996429df2bfff37ca2a5")
|
version("1.4.2", sha256="5d027d7e4e34cb62508803e51d6bd2f477932ad68948996429df2bfff37ca2a5")
|
||||||
|
|
||||||
fabrics = (
|
fabrics = (
|
||||||
|
conditional("cxi", when=spack.platforms.cray.slingshot_network()),
|
||||||
"efa",
|
"efa",
|
||||||
"gni",
|
"gni",
|
||||||
"mlx",
|
"mlx",
|
||||||
@ -63,6 +70,9 @@ class Libfabric(AutotoolsPackage):
|
|||||||
"xpmem",
|
"xpmem",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# CXI is a closed source package and only exists when an external.
|
||||||
|
conflicts("fabrics=cxi")
|
||||||
|
|
||||||
variant(
|
variant(
|
||||||
"fabrics",
|
"fabrics",
|
||||||
default="sockets,tcp,udp",
|
default="sockets,tcp,udp",
|
||||||
@ -106,6 +116,30 @@ class Libfabric(AutotoolsPackage):
|
|||||||
conflicts("@1.9.0", when="platform=darwin", msg="This distribution is missing critical files")
|
conflicts("@1.9.0", when="platform=darwin", msg="This distribution is missing critical files")
|
||||||
conflicts("fabrics=opx", when="@:1.14.99")
|
conflicts("fabrics=opx", when="@:1.14.99")
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def determine_version(cls, exe):
|
||||||
|
output = Executable(exe)("--version", output=str, error=str)
|
||||||
|
match = re.search(r"libfabric: (\d+\.\d+\.\d+)(\D*\S*)", output)
|
||||||
|
return match.group(1) if match else None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def determine_variants(cls, exes, version):
|
||||||
|
results = []
|
||||||
|
for exe in exes:
|
||||||
|
variants = []
|
||||||
|
output = Executable(exe)("--list", output=str, error=os.devnull)
|
||||||
|
# fabrics
|
||||||
|
fabrics = get_options_from_variant(cls, "fabrics")
|
||||||
|
used_fabrics = []
|
||||||
|
for fabric in fabrics:
|
||||||
|
match = re.search(r"^%s:.*\n.*version: (\S+)" % fabric, output, re.MULTILINE)
|
||||||
|
if match:
|
||||||
|
used_fabrics.append(fabric)
|
||||||
|
if used_fabrics:
|
||||||
|
variants.append("fabrics=" + ",".join(used_fabrics))
|
||||||
|
results.append(" ".join(variants))
|
||||||
|
return results
|
||||||
|
|
||||||
def setup_build_environment(self, env):
|
def setup_build_environment(self, env):
|
||||||
if self.run_tests:
|
if self.run_tests:
|
||||||
env.prepend_path("PATH", self.prefix.bin)
|
env.prepend_path("PATH", self.prefix.bin)
|
||||||
@ -125,7 +159,7 @@ def configure_args(self):
|
|||||||
else:
|
else:
|
||||||
args.append("--with-kdreg=no")
|
args.append("--with-kdreg=no")
|
||||||
|
|
||||||
for fabric in self.fabrics:
|
for fabric in [f if isinstance(f, str) else f[0].value for f in self.fabrics]:
|
||||||
if "fabrics=" + fabric in self.spec:
|
if "fabrics=" + fabric in self.spec:
|
||||||
args.append("--enable-{0}=yes".format(fabric))
|
args.append("--enable-{0}=yes".format(fabric))
|
||||||
else:
|
else:
|
||||||
@ -136,3 +170,20 @@ def configure_args(self):
|
|||||||
def installcheck(self):
|
def installcheck(self):
|
||||||
fi_info = Executable(self.prefix.bin.fi_info)
|
fi_info = Executable(self.prefix.bin.fi_info)
|
||||||
fi_info()
|
fi_info()
|
||||||
|
|
||||||
|
|
||||||
|
# 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
|
||||||
|
explicit_values = []
|
||||||
|
if getattr(values, "feature_values", None):
|
||||||
|
values = values.feature_values
|
||||||
|
for value in sorted(values):
|
||||||
|
if hasattr(value, "when"):
|
||||||
|
if value.when is True:
|
||||||
|
# Explicitly extract the True value for downstream use
|
||||||
|
explicit_values.append("{0}".format(value))
|
||||||
|
else:
|
||||||
|
explicit_values.append(value)
|
||||||
|
return explicit_values
|
||||||
|
Loading…
Reference in New Issue
Block a user