Add libcxi and its dependencies (#47705)

This commit is contained in:
Richard Berger 2024-12-13 16:09:17 -07:00 committed by GitHub
parent c310c2911a
commit d2372f8eee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 131 additions and 5 deletions

View File

@ -0,0 +1,24 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class CassiniHeaders(Package):
"""This package provides hardware definitions and C headers for use by the
Linux driver and by user-space applications for the Cassini/Slingshot
+high-speed network interconnect made by HPE (formerly Cray)"""
homepage = "https://github.com/HewlettPackard/shs-cassini-headers"
git = "https://github.com/HewlettPackard/shs-cassini-headers.git"
license("GPL-2.0-only or BSD-2-Clause")
version("main", branch="main")
def install(self, spec, prefix):
with working_dir(self.stage.source_path):
copy_tree("include", prefix.include)
copy_tree("share", prefix.share)

View File

@ -0,0 +1,22 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class CxiDriver(Package):
"""This are the Linux driver headers for the Cray/HPE Cassini 1 and 2
high-speed network interconnect (aka. Slingshot), and its Ethernet driver."""
homepage = "https://github.com/HewlettPackard/shs-cxi-driver"
git = "https://github.com/HewlettPackard/shs-cxi-driver.git"
license("GPL-2.0")
version("main", branch="main")
def install(self, spec, prefix):
with working_dir(self.stage.source_path):
copy_tree("include", prefix.include)

View File

@ -0,0 +1,74 @@
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class Libcxi(AutotoolsPackage):
"""The CXI library provides interfaces which interact directly with CXI
drivers."""
homepage = "https://github.com/HewlettPackard/shs-libcxi"
git = "https://github.com/HewlettPackard/shs-libcxi.git"
license("LGPL-2.1-or-later or BSD-3-Clause")
# no releases, tags: see https://github.com/HewlettPackard/shs-libcxi/issues/2
version("main", branch="main")
variant("level_zero", default=False, description="Enable level zero support")
variant("cuda", default=False, description="Build with CUDA support")
variant("rocm", default=False, description="Build with ROCm support")
depends_on("c", type="build")
depends_on("cassini-headers")
depends_on("cxi-driver")
depends_on("libconfig@1.5:")
depends_on("libuv@1.18:")
# configure fails with newer libfuse
# see https://github.com/HewlettPackard/shs-libcxi/issues/3
depends_on("libfuse@2.9.7:2")
depends_on("libyaml@0.1.7:")
depends_on("libnl@3:")
depends_on("numactl@2:")
depends_on("lm-sensors")
depends_on("oneapi-level-zero", when="+level_zero")
depends_on("cuda", when="+cuda")
depends_on("hip", when="+rocm")
# required due to https://github.com/HewlettPackard/shs-libcxi/issues/4
def patch(self):
filter_file(
r"/usr/share/cassini-headers/csr_defs.json",
f"{self.spec['cassini-headers'].prefix}/share/cassini-headers/csr_defs.json",
"utils/cxi_dump_csrs.py",
string=True,
)
@when("@main")
def autoreconf(self, spec, prefix):
sh = which("sh")
sh("autogen.sh")
def setup_build_environment(self, env):
env.append_flags("CFLAGS", f"-I{self.spec['cassini-headers'].prefix.include}")
def configure_args(self):
args = [
f"--with-udevrulesdir={self.prefix}/lib/udev/rules.d",
f"--with-systemdsystemunitdir={self.prefix}/lib/systemd/system",
]
if self.spec.satisfies("+level_zero"):
args.append(f"--with-ze={self.spec['oneapi-level-zero'].prefix}")
if self.spec.satisfies("+cuda"):
args.append(f"--with-cuda={self.spec['cuda'].prefix}")
if self.spec.satisfies("+rocm"):
args.append(f"--with-rocm={self.spec['hip'].prefix}")
return args

View File

@ -6,7 +6,6 @@
import os import os
import re import re
import spack.platforms.cray
from spack.package import * from spack.package import *
@ -69,7 +68,7 @@ class Libfabric(AutotoolsPackage, CudaPackage):
depends_on("c", type="build") # generated depends_on("c", type="build") # generated
fabrics = ( fabrics = (
conditional("cxi", when=spack.platforms.cray.slingshot_network()), "cxi",
"efa", "efa",
"gni", "gni",
"mlx", "mlx",
@ -90,9 +89,6 @@ class Libfabric(AutotoolsPackage, CudaPackage):
"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",
@ -132,11 +128,14 @@ class Libfabric(AutotoolsPackage, CudaPackage):
depends_on("numactl", when="fabrics=opx") depends_on("numactl", when="fabrics=opx")
depends_on("liburing@2.1:", when="+uring") depends_on("liburing@2.1:", when="+uring")
depends_on("oneapi-level-zero", when="+level_zero") depends_on("oneapi-level-zero", when="+level_zero")
depends_on("libcxi", when="fabrics=cxi")
depends_on("m4", when="@main", type="build") depends_on("m4", when="@main", type="build")
depends_on("autoconf", when="@main", type="build") depends_on("autoconf", when="@main", type="build")
depends_on("automake", when="@main", type="build") depends_on("automake", when="@main", type="build")
depends_on("libtool", when="@main", type="build") depends_on("libtool", when="@main", type="build")
depends_on("json-c", when="fabrics=cxi")
depends_on("curl", when="fabrics=cxi")
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")
@ -209,6 +208,13 @@ def configure_args(self):
else: else:
args.append(f"--disable-{fabric}") args.append(f"--disable-{fabric}")
if self.spec.satisfies("fabrics=cxi"):
args.append(f"--with-json-c={self.spec['json-c'].prefix}")
args.append(f"--with-curl={self.spec['curl'].prefix}")
args.append(f"--with-cassini-headers={self.spec['cassini-headers'].prefix.include}")
args.append(f"--with-cxi-uapi-headers={self.spec['cxi-driver'].prefix.include}")
args.append(f"--enable-cxi={self.spec['libcxi'].prefix}")
return args return args
def installcheck(self): def installcheck(self):