From c059943297a88c6cafdc51ca833ee312406b1ab4 Mon Sep 17 00:00:00 2001 From: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com> Date: Fri, 20 Nov 2026 07:42:21 -0600 Subject: [PATCH] Support single-function-per-port topologies across transport-core, net-sircl, and fabric-tool Allow port0 and port1 in topology files to name one RDMA function per physical port (two HCAs per host) in addition to the existing two-function-per-port layout, while preserving struct sircl_core_topology ABI 1. - transport-core: accept one or two device identifiers on port0/port1, require both ports to have the same count, and return 1 or 2 lanes from sircl_core_topology_route with symmetric path-A selection on tied shortest paths. - net-sircl: handle 1-lane routes in sircl_route_function, sircl_route_allowances, sircl_split_allowances, routes_from_topology, NET_SIRCL_ROUTES overrides, and net_sircl_topology_routes. - fabric-tool: support 2-role FabricBindings (lanes == 1), default single- function paths to same-function relay egress, and generalize planning, facts binding, and cable subnet checks across 1 or 2 function classes. - Add examples/ring4-two-hca.topology, update docs/configuration.md and SOURCE.json, and expand conformance, fabric-tool, and emulated 4-rank progress tests. --- SOURCE.json | 6 +-- docs/configuration.md | 30 +++++++------ examples/ring4-two-hca.topology | 7 +++ fabric-tool/fabric_tool/facts.py | 12 +++-- fabric-tool/fabric_tool/model.py | 21 ++++++--- fabric-tool/fabric_tool/ops.py | 7 +-- fabric-tool/fabric_tool/plan.py | 8 ++-- fabric-tool/fabric_tool/topology.py | 27 ++++++++---- fabric-tool/tests/test_topology.py | 63 +++++++++++++++++++++++++++ net-sircl/net_sircl_config.h | 35 ++++++++++----- net-sircl/net_sircl_plan.c | 22 +++++++--- net-sircl/tests/test_net_sircl.py | 37 ++++++++++++++++ tests/test_release.py | 2 +- tests/test_topology_conformance.py | 41 ++++++++++++----- transport-core/src/topology.c | 35 ++++++++++----- transport-core/tests/test_planning.py | 8 +++- 16 files changed, 278 insertions(+), 83 deletions(-) create mode 100644 examples/ring4-two-hca.topology diff --git a/SOURCE.json b/SOURCE.json index 0af7bb5..3f82cf9 100644 --- a/SOURCE.json +++ b/SOURCE.json @@ -142,9 +142,9 @@ "net-sircl/net_sircl.h": "de03b0ae808c101c2a3acc1dc7361b78eaf3d6baefa94f21af97723cb4a978d1", "net-sircl/net_sircl_admission.h": "6e92a7e07863fc7667f1db549ac89761a34a4a372388497915fb6c362fea1409", "net-sircl/net_sircl_compat.h": "0053800750c2f061a1254d1db95e65e4317de000c1b52873c0fe2cec9afafdf9", - "net-sircl/net_sircl_config.h": "872feba25ac32d7e4e5e1444787edb8fe78188b6484e8fac58758dbc092dac37", + "net-sircl/net_sircl_config.h": "5e4f8396caf08e3ebcc1a32e9a0d5d6952715407fdf301c0a1dde48ccea80243", "net-sircl/net_sircl_connection.h": "901f799e6964445294f2a5fbca0413419d601f8a0cd5bde59f948a8650cff067", - "net-sircl/net_sircl_plan.c": "6fc1f03374562864b5b5898a54f4b2cf471e6d11003af83839e0f5a1f777e856", + "net-sircl/net_sircl_plan.c": "27a9eac56ad81695b3f17fcebd63208997094516eadf1d40c69d77345b6e5011", "net-sircl/net_sircl_plan.h": "dcb857dce8247ff61756e216e90cfd40c6ce3a2b24f5e990b39ec561d2169526", "net-sircl/net_sircl_profile.h": "58b2d994f86fbc88fba4b4d90f332142c52610fcb069dbb2990356734ac076fe", "net-sircl/net_sircl_tuner.h": "30190717119d61bf1f25b184b1b1ad8f661ac8915c888e55ae013bff2a344bf1", @@ -178,7 +178,7 @@ "transport-core/src/shm_memory.h": "defe5e56c0162f2c2ce3d7484693b2771bf0afb953f8a9994ba8ebe5e4f1e01b", "transport-core/src/shm_verbs.c": "2bc7a33b4e492c1ab0ee25de3527695420ce7ddde4bd4b9b5128874093a1686b", "transport-core/src/sysfs.c": "747062778a2cab1744d43e602c724b1887ad6ba66428d62ee892b351f7f5b7c2", - "transport-core/src/topology.c": "0719f36aa7b5a3b4754c180166ed3d8620a67bf9d285aed3faf92d4fbc9852f4", + "transport-core/src/topology.c": "c0a61fd97072a7114bf39890055b8d17dff891ce3930d2970faaa4fcc4200832", "transport-core/src/verbs_dl.c": "ea38fd0ef71bc215f8d97c4f836179aa9190dc87a34125a4a24a96e23bbc4d84", "transport-core/tests/fake_verbs/infiniband/verbs.h": "8c2173547a2169bb455d103b7842463168e75d4350f4434d92ab5dabc353c64c", "transport-core/tests/test_core.c": "af1228e52b14a1da826573e8eb604ca27ffaf603d3aa7f464b00a4b729f0c2c0", diff --git a/docs/configuration.md b/docs/configuration.md index 177de05..951efe7 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -15,24 +15,26 @@ cabling ring | `hosts ...` | host names in position order, 2 to 64 of them, each at most 63 characters; several `hosts` lines append; a host finds its own position by its host name (`NET_SIRCL_POSITION` overrides) | | `cabling ring` / `path` / `explicit` | required. `ring`: host i's port 0 is cabled to host i+1's port 1, and the last host to the first; `path`: the same without the closing cable; `explicit`: only `cable` lines. With two hosts `ring` and `path` both mean the one cable `0.port0`–`1.port1` | | `cable .port

.port` | one cable (repeatable); positions are plain decimal numbers and ports are 0 or 1 | -| `port0 `, `port1 ` | the two RDMA functions of each port, lane order (default `rocep1s0f0 roceP2p1s0f0` and `rocep1s0f1 roceP2p1s0f1`, the DGX OS names); letters, digits and `_.:-`, at most 63 characters | +| `port0 []`, `port1 []` | one or two RDMA functions per port in lane order (both ports must have the same count; default two functions per port: `rocep1s0f0 roceP2p1s0f0` and `rocep1s0f1 roceP2p1s0f1`); letters, digits and `_.:-`, at most 63 characters | | `relay_budget ` | directional budget ceiling, 65536–393216 bytes; default ceiling 393216, further limited by `NET_SIRCL_RELAY_BUDGET` | A topology file is required, including for a direct pair. The plugin derives the shortest cabled path, -the local functions of its two lanes, the relays on the way and the source allowance. Each physical port -must have at most one cable; host names must be unique. Expose both functions required by each route. Where two directions are equally short (the opposite host of an -even ring, or a pair joined by two cables), lane 0 takes the direction that leaves the lower position through -its port 0 and lane 1 the other, at both ends, whichever way round `explicit` cabling connects the hosts -between; the standalone route and queue-model tests verify it. A pair joined by two cables is written with -`cabling explicit` and two `cable` lines. +the local functions of its one or two lanes, the relays on the way and the source allowance. Each physical port +must have at most one cable; host names must be unique. Expose the functions required by each route. Where two +directions are equally short (the opposite host of an even ring, or a pair joined by two cables), lane 0 takes +the direction that leaves the lower position through its port 0 and (in two-function topologies) lane 1 takes +the other, at both ends, whichever way round `explicit` cabling connects the hosts between; the standalone route +and queue-model tests verify it. A pair joined by two cables is written with `cabling explicit` and two `cable` +lines. A two-HCA ring or path (one RDMA function per physical port) sets one name on both `port0` and `port1` +(see `examples/ring4-two-hca.topology`). The file is refused, with the line and the rule, rather than interpreted loosely: an unknown key, a missing -`cabling` line, extra words after a key, a `port0`/`port1` line without exactly two names, a name that is too -long, a line over 1022 characters, a host that no cable reaches, or cables that do not join every host into -one path or one cycle. `fabric-tool` reads the same file by the same rules, and a shared test holds the two -parsers to the same cables and lanes. One difference is deliberate: the plugin accepts the same function name -for both ports (the emulation tests use it, and relay admission then keeps the aggregate model), while -`fabric-tool` requires four distinct functions. +`cabling` line, extra words after a key, a `port0`/`port1` line with zero or more than two names, mismatched +function counts between `port0` and `port1`, a name that is too long, a line over 1022 characters, a host that +no cable reaches, or cables that do not join every host into one path or one cycle. `fabric-tool` reads the same +file by the same rules, and a shared test holds the two parsers to the same cables and lanes. One difference is +deliberate: the plugin accepts the same function name for both ports (the emulation tests use it, and relay +admission then keeps the aggregate model), while `fabric-tool` requires distinct functions across both ports. The NCCL ranks may be a subset of the hosts: a path of three Sparks inside a ring of four lists all four hosts, and the fourth relays. @@ -43,7 +45,7 @@ and the fourth relays. |---|---|---| | `NET_SIRCL_TOPOLOGY` | required | topology shared by all hosts, including relay-only hosts | | `NET_SIRCL_POSITION` | from the topology file's host names | this process's position | -| `NET_SIRCL_ROUTES` | unset | optional `=/,...`; must exactly match topology lanes | +| `NET_SIRCL_ROUTES` | unset | optional `=` (one-function ports) or `=/,...` (two-function ports); must exactly match topology lanes | | `NET_SIRCL_WINDOWS` | unset | `=,...`; direct peers: optional per-function payload cap; relayed peers: can only lower the shared source allowance; 0 is rejected for relayed peers | | `NET_SIRCL_HCA` | every active RoCE function | comma list of functions to expose | | `NET_SIRCL_GID_INDEX` | the function's RoCE v2 IPv4 GID | GID index, 0–255 | diff --git a/examples/ring4-two-hca.topology b/examples/ring4-two-hca.topology new file mode 100644 index 0000000..4243952 --- /dev/null +++ b/examples/ring4-two-hca.topology @@ -0,0 +1,7 @@ +net-sircl-topology +# Four hosts in a ring with one RDMA function per physical port (two HCAs per host). +# Port 0 of host i is cabled to port 1 of host (i + 1) mod 4. +hosts spark1 spark2 spark3 spark4 +cabling ring +port0 rocep1s0f0 +port1 rocep1s0f1 diff --git a/fabric-tool/fabric_tool/facts.py b/fabric-tool/fabric_tool/facts.py index d66e33b..0064495 100644 --- a/fabric-tool/fabric_tool/facts.py +++ b/fabric-tool/fabric_tool/facts.py @@ -150,9 +150,15 @@ def bind(document: dict[str, object], topology: Topology) -> Facts: raise FabricError(f"the hosts name function {device} by different network devices " f"{sorted(named)}; every host must name it alike") netdevs[device] = named.pop() - roles = tuple(model.Role(("cw_primary", "cw_secondary", "ccw_primary", "ccw_secondary")[index], - device, netdevs[device], index // 2, bool(index % 2)) - for index, device in enumerate(topology.functions)) + if topology.lanes == 1: + roles = ( + model.Role("cw_primary", topology.functions[0], netdevs[topology.functions[0]], 0, False), + model.Role("ccw_primary", topology.functions[1], netdevs[topology.functions[1]], 1, False), + ) + else: + roles = tuple(model.Role(("cw_primary", "cw_secondary", "ccw_primary", "ccw_secondary")[index], + device, netdevs[device], index // 2, bool(index % 2)) + for index, device in enumerate(topology.functions)) bindings = model.FabricBindings(roles) hosts = [] for position, name in enumerate(topology.hosts): diff --git a/fabric-tool/fabric_tool/model.py b/fabric-tool/fabric_tool/model.py index 1afb4ee..921b262 100644 --- a/fabric-tool/fabric_tool/model.py +++ b/fabric-tool/fabric_tool/model.py @@ -65,21 +65,30 @@ def label(self) -> str: @dataclasses.dataclass(frozen=True) class FabricBindings: - """Four validated RDMA functions and their Ethernet interfaces for one operation.""" + """Two or four validated RDMA functions and their Ethernet interfaces for one operation.""" roles: tuple[Role, ...] = DEFAULT_ROLES def __post_init__(self) -> None: object.__setattr__(self, "roles", tuple(self.roles)) - if len(self.roles) != 4: - raise FabricError("a role table holds four functions") + if len(self.roles) not in (2, 4): + raise FabricError("a role table holds two or four functions") for role in self.roles: device_name(role.device) device_name(role.netdev) - if len(set(self.devices)) != 4 or len(set(self.netdevs)) != 4: + if len(set(self.devices)) != len(self.roles) or len(set(self.netdevs)) != len(self.roles): raise FabricError("a role table names one device or interface for two functions") - if sorted((r.port, r.secondary) for r in self.roles) != [(0, False), (0, True), (1, False), (1, True)]: - raise FabricError("a role table needs both function classes of each port") + slots = sorted((r.port, r.secondary) for r in self.roles) + if slots not in ([(0, False), (1, False)], [(0, False), (0, True), (1, False), (1, True)]): + raise FabricError("a role table needs one or both function classes of each port") + + @property + def lanes(self) -> int: + return len(self.roles) // 2 + + @property + def classes(self) -> tuple[bool, ...]: + return (False, True) if self.lanes == 2 else (False,) @property def devices(self) -> tuple[str, ...]: diff --git a/fabric-tool/fabric_tool/ops.py b/fabric-tool/fabric_tool/ops.py index e731568..2a4ce83 100644 --- a/fabric-tool/fabric_tool/ops.py +++ b/fabric-tool/fabric_tool/ops.py @@ -127,7 +127,7 @@ def cable_problems(group: GroupSpec, facts: Facts) -> list[str]: the cabling.""" problems = [] for cable in group.layout.fabric.cables: - for secondary in (False, True): + for secondary in facts.bindings.classes: here = facts.port(cable.a, facts.bindings.role_at(cable.a_port, secondary).netdev) there = facts.port(cable.b, facts.bindings.role_at(cable.b_port, secondary).netdev) networks = (here.network(), there.network()) @@ -146,7 +146,7 @@ def unchecked_cables(group: GroupSpec, facts: Facts) -> list[str]: length, so its subnet is unknown. Reported, so a skipped cabling check is never a silent pass.""" skipped = [] for cable in group.layout.fabric.cables: - for secondary in (False, True): + for secondary in facts.bindings.classes: here = facts.port(cable.a, facts.bindings.role_at(cable.a_port, secondary).netdev) there = facts.port(cable.b, facts.bindings.role_at(cable.b_port, secondary).netdev) if here.network() is None or there.network() is None: @@ -198,7 +198,8 @@ def evaluate(topology: Topology, states: dict[int, HostState], file_facts: Facts group = topology.group compared = sorted(set(positions if positions is not None else group.order)) outcome = Outcome(topology, group, mode, None) - problems = model.isolation_problems([model.derive_routes(group.layout, 2, bindings=file_facts.bindings if file_facts else topology.bindings)]) + initial_bindings = file_facts.bindings if file_facts else topology.bindings + problems = model.isolation_problems([model.derive_routes(group.layout, initial_bindings.lanes, bindings=initial_bindings)]) if problems: raise FabricError("isolation: " + "; ".join(problems)) read_facts = facts_from(states, bindings=file_facts.bindings if file_facts else topology.bindings) diff --git a/fabric-tool/fabric_tool/plan.py b/fabric-tool/fabric_tool/plan.py index ceacb7c..bc68bee 100644 --- a/fabric-tool/fabric_tool/plan.py +++ b/fabric-tool/fabric_tool/plan.py @@ -452,6 +452,8 @@ def build_group_plan(group: GroupSpec, facts: Facts, *, relay_egress: str, """The relay plan of one group (module docstring), checked by :func:`trace` on every origin route.""" if relay_egress not in ("same", "sibling"): raise FabricError(f"relay egress must be same or sibling, got {relay_egress!r}") + if facts.bindings.lanes == 1 and relay_egress == "sibling": + raise FabricError("sibling relay egress requires two functions per port") if not 0 <= max_relays <= MAX_TAG: raise FabricError(f"the relay limit must be between 0 and {MAX_TAG} (one tag per relay count)") layout = group.layout @@ -470,9 +472,9 @@ def build_group_plan(group: GroupSpec, facts: Facts, *, relay_egress: str, f"group {group.label}: host {target} is {len(path)} cables from host {origin}, " f"{len(path) - 1} relays; the configured limit is {max_relays} (" "--max-relays raises it, research-only)") - for secondary in (False, True): + for secondary in facts.bindings.classes: _carry(path, secondary, facts, relay_egress, routes_at, filters_at, group.label) - sircl = model.derive_routes(layout, 2, bindings=facts.bindings) + sircl = model.derive_routes(layout, facts.bindings.lanes, bindings=facts.bindings) lanes_of: dict[tuple[int, str], list[str]] = {} for rank, peers in enumerate(sircl.ranks): origin = layout.positions[rank] @@ -523,7 +525,7 @@ def build_group_plan(group: GroupSpec, facts: Facts, *, relay_egress: str, def build_plan(group: GroupSpec, facts: Facts, *, max_relays: int = model.DEFAULT_MAX_RELAYS) -> GroupPlan: """The plan of a topology's group, checked for isolation.""" - problems = model.isolation_problems([model.derive_routes(group.layout, 2, bindings=facts.bindings)]) + problems = model.isolation_problems([model.derive_routes(group.layout, facts.bindings.lanes, bindings=facts.bindings)]) plan = build_group_plan(group, facts, relay_egress=group.relay_egress, max_relays=max_relays) problems += isolation_problems([plan]) if problems: diff --git a/fabric-tool/fabric_tool/topology.py b/fabric-tool/fabric_tool/topology.py index f4852f0..ada473a 100644 --- a/fabric-tool/fabric_tool/topology.py +++ b/fabric-tool/fabric_tool/topology.py @@ -134,6 +134,10 @@ class Topology: functions: tuple[str, ...] # port 0 lane 0/1, port 1 lane 0/1 budget: int + @property + def lanes(self) -> int: + return len(self.functions) // 2 + @property def bindings(self) -> model.FabricBindings: return model.FabricBindings(_roles_of_functions(self.functions)) @@ -169,12 +173,17 @@ def group(self) -> GroupSpec: def _roles_of_functions(functions: tuple[str, ...]) -> tuple[Role, ...]: - """The four roles of a topology's function names, with the DGX OS network devices as defaults. + """The two or four roles of a topology's function names, with the DGX OS network devices as defaults. The facts file (or a host read) binds each function to its network device; until then the roles carry the default devices, which the fact checks replace when a host names others. """ + if len(functions) == 2: + return ( + Role("cw_primary", functions[0], DEFAULT_NETDEVS[0], 0, False), + Role("ccw_primary", functions[1], DEFAULT_NETDEVS[2], 1, False), + ) roles = [] for index, device in enumerate(functions): port, secondary = divmod(index, 2) @@ -187,7 +196,7 @@ def parse(text: str, *, path: str = "") -> Topology: """Parse topology file text; FabricError names the line and the rule.""" hosts: list[str] = [] cables: list[Cable] = [] - functions: list[str] = list(DEFAULT_FUNCTIONS) + port_functions: list[list[str]] = [list(DEFAULT_FUNCTIONS[:2]), list(DEFAULT_FUNCTIONS[2:])] budget = DEFAULT_BUDGET cabling = "" for lineno, raw in enumerate(text.splitlines(), start=1): @@ -210,11 +219,10 @@ def parse(text: str, *, path: str = "") -> Topology: except FabricError: raise FabricError(f"{path}:{lineno}: a cable is `cable .port<0|1> .port<0|1>`") from None elif key in ("port0", "port1"): - if len(rest) != 2: - raise FabricError(f"{path}:{lineno}: {key} requires exactly two device identifiers") + if len(rest) not in (1, 2): + raise FabricError(f"{path}:{lineno}: {key} requires one or two device identifiers") port = int(key[-1]) - for lane, name in enumerate(rest[:2]): - functions[2 * port + lane] = name + port_functions[port] = list(rest) elif key == "relay_budget": if len(rest) != 1 or not _DECIMAL.fullmatch(rest[0]) or int(rest[0]) == 0: raise FabricError(f"{path}:{lineno}: relay_budget is a positive byte count") @@ -240,7 +248,10 @@ def parse(text: str, *, path: str = "") -> Topology: last = len(hosts) if cabling == "ring" and len(hosts) > 2 else len(hosts) - 1 for i in range(last): cables.append(Cable(i, 0, (i + 1) % len(hosts), 1)) - if len(set(functions)) != 4: + if len(port_functions[0]) != len(port_functions[1]): + raise FabricError(f"{path}: port0 and port1 must name the same number of functions (1 or 2)") + functions = port_functions[0] + port_functions[1] + if len(set(functions)) != len(functions): raise FabricError(f"{path}: port0 and port1 name one function twice") try: fabric = Fabric(tuple(cables)) @@ -276,7 +287,7 @@ def _group_of(topology: Topology) -> GroupSpec: """The one group of a topology: whole cycle or path, with the topology relay-egress default.""" fabric = Fabric(topology.cables) layout = Layout(fabric, tuple(range(topology.size))) - egress = "same" if fabric.kind == "cycle" else "sibling" + egress = "same" if fabric.kind == "cycle" or topology.lanes == 1 else "sibling" return GroupSpec(layout, egress, topology.layout_name, topology.bindings) diff --git a/fabric-tool/tests/test_topology.py b/fabric-tool/tests/test_topology.py index a6560a4..13aa989 100644 --- a/fabric-tool/tests/test_topology.py +++ b/fabric-tool/tests/test_topology.py @@ -125,3 +125,66 @@ def test_load_preserves_default_bindings(tmp_path): ring = topology.load(path) assert ring.bindings.devices == ring.functions assert model.DEFAULT_BINDINGS.roles == model.DEFAULT_ROLES + + +def test_single_function_per_port_ring_and_path_plan_and_facts(): + from fabric_tool import facts as facts_mod, ops, plan as plan_mod + + ring = topology.parse("hosts s0 s1 s2 s3\ncabling ring\nport0 mlx5_0\nport1 mlx5_1\n") + assert ring.lanes == 1 + assert ring.functions == ("mlx5_0", "mlx5_1") + assert ring.bindings.lanes == 1 + assert ring.bindings.devices == ("mlx5_0", "mlx5_1") + assert ring.group.relay_egress == "same" + + sym = plan_mod.Facts.symbolic_for(ring.hosts, bindings=ring.bindings) + ring_plan = plan_mod.build_plan(ring.group, sym) + assert ring_plan.sircl.lanes == 1 + assert ring_plan.sircl.route_text(0) == "1=mlx5_0,2=mlx5_0,3=mlx5_1" + assert ring_plan.sircl.route_text(2) == "0=mlx5_1,1=mlx5_1,3=mlx5_0" + assert len(ring_plan.host(0).routes) == 2 + assert [r.lanes for r in ring_plan.host(0).routes if r.lanes] == [("rank 0->2 lane 0",)] + assert len(ring_plan.host(1).filters) == 2 + + # Facts binding + cable subnet check with /30 per-cable subnets + doc = { + "schema": facts_mod.FACTS_SCHEMA, + "hosts": [ + {"name": "s0", "position": 0, "functions": { + "mlx5_0": {"netdev": "eth0", "mac": "00:11:22:33:44:00", "address": "198.51.100.1/30"}, + "mlx5_1": {"netdev": "eth1", "mac": "00:11:22:33:44:01", "address": "198.51.100.14/30"}, + }}, + {"name": "s1", "position": 1, "functions": { + "mlx5_0": {"netdev": "eth0", "mac": "00:11:22:33:44:10", "address": "198.51.100.5/30"}, + "mlx5_1": {"netdev": "eth1", "mac": "00:11:22:33:44:11", "address": "198.51.100.2/30"}, + }}, + {"name": "s2", "position": 2, "functions": { + "mlx5_0": {"netdev": "eth0", "mac": "00:11:22:33:44:20", "address": "198.51.100.9/30"}, + "mlx5_1": {"netdev": "eth1", "mac": "00:11:22:33:44:21", "address": "198.51.100.6/30"}, + }}, + {"name": "s3", "position": 3, "functions": { + "mlx5_0": {"netdev": "eth0", "mac": "00:11:22:33:44:30", "address": "198.51.100.13/30"}, + "mlx5_1": {"netdev": "eth1", "mac": "00:11:22:33:44:31", "address": "198.51.100.10/30"}, + }}, + ], + } + bound = facts_mod.bind(doc, ring) + assert bound.bindings.lanes == 1 + assert ops.cable_problems(ring.group, bound) == [] + concrete = plan_mod.build_plan(ring.group, bound) + assert concrete.host(0).routes[0].destination == "198.51.100.6" + + # Single-function path automatically uses same-function egress (no sibling exists) + path = topology.parse("hosts s0 s1 s2 s3\ncabling path\nport0 mlx5_0\nport1 mlx5_1\n") + assert path.group.relay_egress == "same" + path_plan = plan_mod.build_plan(path.group, plan_mod.Facts.symbolic_for(path.hosts, bindings=path.bindings)) + assert path_plan.sircl.route_text(0) == "1=mlx5_0,2=mlx5_0,3=mlx5_0" + assert path_plan.sircl.route_text(3) == "0=mlx5_1,1=mlx5_1,2=mlx5_1" + + with pytest.raises(model.FabricError, match="same number of functions"): + topology.parse("hosts a b\ncabling path\nport0 mlx5_0\n") + with pytest.raises(model.FabricError, match="same number of functions"): + topology.parse("hosts a b\ncabling path\nport0 mlx5_0\nport1 mlx5_1 mlx5_2\n") + with pytest.raises(model.FabricError, match="sibling relay egress"): + plan_mod.build_group_plan(path.group, sym, relay_egress="sibling") + diff --git a/net-sircl/net_sircl_config.h b/net-sircl/net_sircl_config.h index 81d31fe..568fdc4 100644 --- a/net-sircl/net_sircl_config.h +++ b/net-sircl/net_sircl_config.h @@ -110,7 +110,10 @@ static ncclResult_t route_overrides(void) { struct route *r = &g.routes[peer]; if (!kind) { char expected[160]; - snprintf(expected, sizeof expected, "%s/%s", g.devs[r->dev[0]].name, g.devs[r->dev[1]].name); + if (r->ndev == 1) + snprintf(expected, sizeof expected, "%s", g.devs[r->dev[0]].name); + else + snprintf(expected, sizeof expected, "%s/%s", g.devs[r->dev[0]].name, g.devs[r->dev[1]].name); if (strcmp(expected, eq + 1)) goto invalid; } else { if (!eq[1]) goto invalid; @@ -177,20 +180,23 @@ static int routes_from_topology(const char *path) { if (peer == me) continue; const char *fn[2]; int relays = 0; - if (sircl_core_topology_route(&t, me, peer, fn, &relays) < 0) continue; + int nlanes = sircl_core_topology_route(&t, me, peer, fn, &relays); + if (nlanes < 0) continue; struct route *r = &g.routes[peer]; r->ndev = 0; - for (int l = 0; l < NET_SIRCL_MAX_LANES; ++l) { + for (int l = 0; l < nlanes; ++l) { int d = dev_by_name(fn[l]); if (d < 0) { - WARN("net-sircl: topology lane %s is not exposed; retain both route lanes in NET_SIRCL_HCA", fn[l]); + WARN("net-sircl: topology lane %s is not exposed; retain route lanes in NET_SIRCL_HCA", fn[l]); return -1; } r->dev[r->ndev++] = d; } r->relays = relays; - uint32_t a = g.relay_windows[r->dev[0]].cap, b = g.relay_windows[r->dev[1]].cap; - r->window = relays > 0 ? (a < b ? a : b) : 0; + uint32_t win = g.relay_windows[r->dev[0]].cap; + for (int l = 1; l < r->ndev; ++l) + if (g.relay_windows[r->dev[l]].cap < win) win = g.relay_windows[r->dev[l]].cap; + r->window = relays > 0 ? win : 0; } return 0; } @@ -214,10 +220,19 @@ int net_sircl_topology_routes(const char *path, int position, char *out, size_t for (int peer = 0; peer < t.nhosts; ++peer) { const char *fn[2]; int relays = 0; - if (peer == position || sircl_core_topology_route(&t, position, peer, fn, &relays) < 0) continue; - uint32_t a = plan.caps[position][sircl_route_function(&t, fn[0])], b = plan.caps[position][sircl_route_function(&t, fn[1])]; - int n = snprintf(out + used, len - used, "%d=%s/%s:%d:%u;", peer, fn[0], fn[1], relays, - relays > 0 ? (a < b ? a : b) : 0u); + int nlanes = peer == position ? -1 : sircl_core_topology_route(&t, position, peer, fn, &relays); + if (nlanes < 0) continue; + uint32_t win = plan.caps[position][sircl_route_function(&t, fn[0])]; + int n; + if (nlanes == 1) { + n = snprintf(out + used, len - used, "%d=%s:%d:%u;", peer, fn[0], relays, + relays > 0 ? win : 0u); + } else { + uint32_t b = plan.caps[position][sircl_route_function(&t, fn[1])]; + if (b < win) win = b; + n = snprintf(out + used, len - used, "%d=%s/%s:%d:%u;", peer, fn[0], fn[1], relays, + relays > 0 ? win : 0u); + } if (n < 0 || (size_t)n >= len - used) return -1; used += (size_t)n; } diff --git a/net-sircl/net_sircl_plan.c b/net-sircl/net_sircl_plan.c index efa3c5a..398df1a 100644 --- a/net-sircl/net_sircl_plan.c +++ b/net-sircl/net_sircl_plan.c @@ -5,8 +5,9 @@ #define ROUTE_MODEL_HOSTS 8 int sircl_route_function(const struct sircl_core_topology *t, const char *name) { + if (!name || !*name) return -1; for (int f = 0; f < ROUTE_FUNCTIONS; ++f) - if (!strcmp(t->fn[f / 2][f % 2], name)) return f; + if (t->fn[f / 2][f % 2][0] && !strcmp(t->fn[f / 2][f % 2], name)) return f; return -1; } @@ -19,9 +20,13 @@ int sircl_route_allowances(const struct sircl_core_topology *t, uint32_t budget, for (int s = 0; s < t->nhosts; ++s) for (int f = 0; f < ROUTE_FUNCTIONS; ++f) caps[s][f] = fallback; if (t->nhosts < 2 || t->nhosts > ROUTE_MODEL_HOSTS) return 0; - for (int f = 0; f < ROUTE_FUNCTIONS; ++f) + int nlanes = t->fn[0][1][0] ? 2 : 1; + if ((t->fn[1][1][0] != 0) != (nlanes == 2)) return 0; + for (int f = 0; f < ROUTE_FUNCTIONS; ++f) { + if (!t->fn[f / 2][f % 2][0]) continue; for (int h = 0; h < f; ++h) - if (!strcmp(t->fn[f / 2][f % 2], t->fn[h / 2][h % 2])) return 0; + if (t->fn[h / 2][h % 2][0] && !strcmp(t->fn[f / 2][f % 2], t->fn[h / 2][h % 2])) return 0; + } int neighbor[ROUTE_MODEL_HOSTS][2], arrival[ROUTE_MODEL_HOSTS][2]; memset(neighbor, -1, sizeof neighbor); @@ -41,9 +46,11 @@ int sircl_route_allowances(const struct sircl_core_topology *t, uint32_t budget, for (int d = 0; d < t->nhosts; ++d) if (d != s) { const char *fn[2], *back[2]; int relays, reverse_relays; - if (sircl_core_topology_route(t, s, d, fn, &relays) < 0) continue; - if (sircl_core_topology_route(t, d, s, back, &reverse_relays) != 2 || reverse_relays != relays) return 0; - for (int lane = 0; lane < 2; ++lane) { + int nl = sircl_core_topology_route(t, s, d, fn, &relays); + if (nl < 0) continue; + if (nl != nlanes || sircl_core_topology_route(t, d, s, back, &reverse_relays) != nl || reverse_relays != relays) + return 0; + for (int lane = 0; lane < nl; ++lane) { int f = sircl_route_function(t, fn[lane]); if (f < 0) return 0; int origin = s * ROUTE_FUNCTIONS + f, u = s, port = f / 2; @@ -89,9 +96,10 @@ int sircl_split_allowances(const struct sircl_core_topology *t, int derived, if (!derived) return 0; for (int s = 0; s < t->nhosts; ++s) for (int f = 0; f < ROUTE_FUNCTIONS; ++f) - if (caps[s][f] < 1280) return 0; + if (t->fn[f / 2][f % 2][0] && caps[s][f] < 1280) return 0; for (int s = 0; s < t->nhosts; ++s) for (int f = 0; f < ROUTE_FUNCTIONS; ++f) { + if (!t->fn[f / 2][f % 2][0]) continue; ack[s][f] = caps[s][f] / 5u / 128u * 128u; caps[s][f] = caps[s][f] * 6u / 5u / 64u * 64u; } diff --git a/net-sircl/tests/test_net_sircl.py b/net-sircl/tests/test_net_sircl.py index 292f006..81b79aa 100644 --- a/net-sircl/tests/test_net_sircl.py +++ b/net-sircl/tests/test_net_sircl.py @@ -334,6 +334,43 @@ def test_topology_pair_and_custom_functions(self): self.assertEqual(self.routes(pair, 0), {"1": "eth0a/eth0b:0:0"}) self.assertEqual(self.routes(pair, 1), {"0": "eth1a/eth1b:0:0"}) + def test_topology_single_function_per_port_routes_and_progress(self): + ring4 = "hosts a b c d\ncabling ring\nport0 mlx5_0\nport1 mlx5_1\n" + self.assertEqual(self.routes(ring4, 0), { + "1": "mlx5_0:0:0", + "2": "mlx5_0:1:393216", + "3": "mlx5_1:0:0", + }) + self.assertEqual(self.routes(ring4, 2), { + "0": "mlx5_1:1:393216", + "1": "mlx5_1:0:0", + "3": "mlx5_0:0:0", + }) + path4 = "hosts a b c d\ncabling path\nport0 mlx5_0\nport1 mlx5_1\nrelay_budget 196608\n" + self.assertEqual(self.routes(path4, 0)["3"], "mlx5_0:2:176896") + self.assertEqual(self.routes(path4, 3)["0"], "mlx5_1:2:176896") + self.assertIn("same number of functions", self.routes("hosts a b\ncabling path\nport0 mlx5_0\n", 0)) + + # Run full 4-rank emulated concurrent progress on 1-function ring and path (only emu0,emu1 exposed). + exe = Path(self.build.name) / "topology_progress_1func_test" + subprocess.run([os.environ.get("CC", "cc"), *FLAGS, *STANDIN_FLAGS, + str(HERE / "tests" / "topology_progress_test.c"), str(STANDIN / "shm_verbs.c"), + *CORE_SOURCES, "-o", str(exe)], check=True) + for cabling in ("ring", "path"): + with self.subTest(cabling=cabling): + topo_file = Path(self.build.name) / f"single_func_{cabling}.topology" + topo_file.write_text(f"hosts h0 h1 h2 h3\ncabling {cabling}\nport0 emu0\nport1 emu1\n") + fabric = f"/sircl-emu-1func-{os.getpid()}-{cabling}" + env = {k: v for k, v in os.environ.items() if not k.startswith("NET_SIRCL_")} + env.update(NET_SIRCL_TOPOLOGY=str(topo_file), NET_SIRCL_HCA="emu0,emu1", + SIRCL_EMU_FABRIC=fabric, NET_SIRCL_RELAY_BUDGET="196608") + try: + res = subprocess.run([str(exe), "4"], env=env, capture_output=True, text=True, timeout=55) + self.assertEqual(res.returncode, 0, res.stdout + res.stderr) + self.assertIn("exact and bounded", res.stdout) + finally: + (Path("/dev/shm") / fabric.lstrip("/")).unlink(missing_ok=True) + def test_topology_explicit_cables(self): text = "hosts a b c\ncabling explicit\ncable 0.port1 2.port0\ncable 2.port1 1.port0\n" routes = self.routes(text, 0) diff --git a/tests/test_release.py b/tests/test_release.py index d7f3bfc..d22a286 100644 --- a/tests/test_release.py +++ b/tests/test_release.py @@ -77,7 +77,7 @@ def test_all_example_routes_parse(self): library = ctypes.CDLL(str(ROOT / "net-sircl/libnccl-net-sircl-emu.so")) routes = library.net_sircl_topology_routes routes.argtypes = [ctypes.c_char_p, ctypes.c_int, ctypes.c_char_p, ctypes.c_size_t] - for name, size in (("pair", 2), ("ring4", 4), ("ring8", 8), ("path4", 4)): + for name, size in (("pair", 2), ("ring4", 4), ("ring4-two-hca", 4), ("ring8", 8), ("path4", 4)): for position in range(size): output = ctypes.create_string_buffer(4096) self.assertEqual(routes(str(ROOT / f"examples/{name}.topology").encode(), position, diff --git a/tests/test_topology_conformance.py b/tests/test_topology_conformance.py index f990c37..357330f 100644 --- a/tests/test_topology_conformance.py +++ b/tests/test_topology_conformance.py @@ -80,6 +80,19 @@ def valid_corpus(): yield f"ring {n}, last host turned", explicit(n, turned(ring(n), {n - 1})) yield "custom functions", "hosts a b c d\ncabling ring\nport0 mlx5_0 mlx5_1\nport1 mlx5_2 mlx5_3\n" yield "one port renamed", "hosts a b c\ncabling path\nport1 left.a right-b\n" + yield "single function ring4", "hosts a b c d\ncabling ring\nport0 mlx5_0\nport1 mlx5_1\n" + yield "single function path4", "hosts a b c d\ncabling path\nport0 mlx5_0\nport1 mlx5_1\n" + yield "single function explicit turned ring", ( + "hosts a b c d\ncabling explicit\n" + "cable 0.port0 1.port1\ncable 1.port0 2.port0\n" + "cable 2.port1 3.port1\ncable 3.port0 0.port1\n" + "port0 rocep1s0f0\nport1 rocep1s0f1\n" + ) + yield "single function two-cable pair", ( + "hosts a b\ncabling explicit\n" + "cable 0.port0 1.port1\ncable 1.port0 0.port1\n" + "port0 mlx5_0\nport1 mlx5_1\n" + ) yield "budget", "hosts a b c d\ncabling path\nrelay_budget 196608\n" yield "comments and spacing", ("# leading comment\nnet-sircl-topology\n\n hosts a\tb c # trailing\n" "\tcabling\tring\r\nrelay_budget 65536 # bytes\n") @@ -112,7 +125,9 @@ def invalid_corpus(): yield "cable with three ends", "hosts a b c\ncabling explicit\ncable 0.port0 1.port1 2.port0\n" yield "cable joined by a dash", "hosts a b\ncabling explicit\ncable 0.port0-1.port1\n" yield "ring plus a cable on a used port", "hosts a b c\ncabling ring\ncable 0.port0 2.port1\n" - yield "port line with one name", "hosts a b\ncabling path\nport0 only\n" + yield "port0 one name with default port1", "hosts a b\ncabling path\nport0 only\n" + yield "mismatched port0 and port1 counts", "hosts a b\ncabling path\nport0 a\nport1 b c\n" + yield "port line with no names", "hosts a b\ncabling path\nport0\n" yield "port line with three names", "hosts a b\ncabling path\nport1 a b c\n" yield "function with a slash", "hosts a b\ncabling path\nport0 ok bad/name\n" yield "function too long", f"hosts a b\ncabling path\nport0 ok {'f' * 64}\n" @@ -175,8 +190,11 @@ def test_valid_files_mean_the_same_fabric_to_both(self): self.assertIsNotNone(c, f"the plugin refuses it: {c_error}") self.assertIsNotNone(py, f"fabric-tool refuses it: {py_error}") self.assertEqual([c.host[i].value.decode() for i in range(c.nhosts)], list(py.hosts)) - self.assertEqual([c.fn[p][lane].value.decode() for p in (0, 1) for lane in (0, 1)], - list(py.functions)) + c_fns = [c.fn[p][lane].value.decode() for p in (0, 1) for lane in range(py.lanes)] + self.assertEqual(c_fns, list(py.functions)) + if py.lanes == 1: + self.assertEqual(c.fn[0][1].value, b"") + self.assertEqual(c.fn[1][1].value, b"") self.assertEqual(c.budget, py.budget) c_cables = {frozenset({(c.cable[i].a, c.cable[i].pa), (c.cable[i].b, c.cable[i].pb)}) for i in range(c.ncables)} @@ -187,10 +205,10 @@ def test_valid_files_mean_the_same_fabric_to_both(self): for a, b in itertools.permutations(range(c.nhosts), 2): names = (ctypes.c_char_p * 2)() relays = ctypes.c_int(-1) - self.assertEqual(self.lib.sircl_core_topology_route(ctypes.byref(c), a, b, names, - ctypes.byref(relays)), 2, (a, b)) - lanes = model.derive_lanes(fabric, a, b, 2, bindings=py.bindings) - self.assertEqual([names[0].decode(), names[1].decode()], + nlanes = self.lib.sircl_core_topology_route(ctypes.byref(c), a, b, names, ctypes.byref(relays)) + self.assertEqual(nlanes, py.lanes, (a, b)) + lanes = model.derive_lanes(fabric, a, b, py.lanes, bindings=py.bindings) + self.assertEqual([names[i].decode() for i in range(nlanes)], [lane.local.device for lane in lanes], (a, b)) self.assertEqual({relays.value}, {lane.hops - 1 for lane in lanes}, (a, b)) count += 1 @@ -203,7 +221,8 @@ def test_lanes_are_the_same_function_class_on_one_path_at_both_ends(self): c, _ = self.plugin(text) if c is None: continue - port_of = {c.fn[p][lane].value: (p, lane) for p in (0, 1) for lane in (0, 1)} + nlanes = 2 if c.fn[0][1].value else 1 + port_of = {c.fn[p][lane].value: (p, lane) for p in (0, 1) for lane in range(nlanes)} far = {} for i in range(c.ncables): cable = c.cable[i] @@ -213,14 +232,14 @@ def test_lanes_are_the_same_function_class_on_one_path_at_both_ends(self): def lanes(a, b): names = (ctypes.c_char_p * 2)() relays = ctypes.c_int(-1) - self.lib.sircl_core_topology_route(ctypes.byref(c), a, b, names, ctypes.byref(relays)) - return [port_of[names[0]], port_of[names[1]]], relays.value + got = self.lib.sircl_core_topology_route(ctypes.byref(c), a, b, names, ctypes.byref(relays)) + return [port_of[names[i]] for i in range(got)], relays.value with self.subTest(case=name): for a, b in itertools.permutations(range(c.nhosts), 2): forward, relays = lanes(a, b) backward, _ = lanes(b, a) - for lane in (0, 1): + for lane in range(nlanes): self.assertEqual(forward[lane][1], lane, (a, b)) here, out = a, forward[lane][0] for _ in range(relays + 1): diff --git a/transport-core/src/topology.c b/transport-core/src/topology.c index 55c4734..a69abb8 100644 --- a/transport-core/src/topology.c +++ b/transport-core/src/topology.c @@ -63,7 +63,7 @@ int sircl_core_topology_parse(const char *path, struct sircl_core_topology *t, c FILE *f = fopen(path, "r"); if (!f) return reject(err, len, "cannot open %s: %s", path, strerror(errno)); char line[1024], cabling[16] = ""; - int lineno = 0, rc = 0; + int lineno = 0, rc = 0, port_lanes[2] = {NET_SIRCL_MAX_LANES, NET_SIRCL_MAX_LANES}; while (!rc && fgets(line, sizeof line, f)) { ++lineno; size_t got = strlen(line); @@ -110,13 +110,20 @@ int sircl_core_topology_parse(const char *path, struct sircl_core_topology *t, c int p = key[4] - '0'; char *v[NET_SIRCL_MAX_LANES + 1]; for (int l = 0; l <= NET_SIRCL_MAX_LANES; ++l) v[l] = strtok_r(NULL, BLANK, &save); - if (!v[0] || !v[1] || v[2]) - rc = reject(err, len, "%s:%d: %s requires exactly two device identifiers", path, lineno, key); - for (int l = 0; !rc && l < NET_SIRCL_MAX_LANES; ++l) { - if (!function_name(v[l])) - rc = reject(err, len, "%s:%d: invalid device identifier %s", path, lineno, v[l]); - else - snprintf(t->fn[p][l], FIELD, "%s", v[l]); + if (!v[0] || v[2]) { + rc = reject(err, len, "%s:%d: %s requires one or two device identifiers", path, lineno, key); + } else { + int count = v[1] ? 2 : 1; + for (int l = 0; !rc && l < count; ++l) { + if (!function_name(v[l])) + rc = reject(err, len, "%s:%d: invalid device identifier %s", path, lineno, v[l]); + else + snprintf(t->fn[p][l], FIELD, "%s", v[l]); + } + if (!rc) { + if (count == 1) t->fn[p][1][0] = '\0'; + port_lanes[p] = count; + } } } else if (!strcmp(key, "relay_budget")) { char *v = strtok_r(NULL, BLANK, &save); @@ -138,6 +145,8 @@ int sircl_core_topology_parse(const char *path, struct sircl_core_topology *t, c if (!rc && ferror(f)) rc = reject(err, len, "cannot read %s", path); fclose(f); if (rc) return rc; + if (port_lanes[0] != port_lanes[1]) + return reject(err, len, "%s: port0 and port1 must name the same number of functions (1 or 2)", path); if (t->nhosts < 2) return reject(err, len, "%s: `hosts` names fewer than two hosts", path); for (int a = 0; a < t->nhosts; ++a) for (int b = a + 1; b < t->nhosts; ++b) @@ -219,6 +228,8 @@ static int topo_cross(const struct sircl_core_topology *t, int host, int port, i * path. -1 when the peer is unreachable. */ int sircl_core_topology_route(const struct sircl_core_topology *t, int me, int peer, const char **fn, int *relays) { if (!t || !fn || !relays || me < 0 || peer < 0 || me >= t->nhosts || peer >= t->nhosts) return -1; + int nlanes = t->fn[0][1][0] ? 2 : 1; + if ((t->fn[1][1][0] != 0) != (nlanes == 2)) return -1; int from_me[MAX_POSITIONS], from_peer[MAX_POSITIONS]; topo_distances(t, me, from_me); topo_distances(t, peer, from_peer); @@ -236,8 +247,8 @@ int sircl_core_topology_route(const struct sircl_core_topology *t, int me, int p if (port_ok[0] != port_ok[1]) { int p = port_ok[0] ? 0 : 1; fn[0] = t->fn[p][0]; - fn[1] = t->fn[p][1]; - return 2; + fn[1] = nlanes == 2 ? t->fn[p][1] : NULL; + return nlanes; } /* Both ports start a shortest path. Path A leaves the lower of the two positions through its port 0. The * higher position sends lane 0 out of the port on which path A arrives there: port 1 in ring cabling, and @@ -256,6 +267,6 @@ int sircl_core_topology_route(const struct sircl_core_topology *t, int me, int p if (at != me) return -1; } fn[0] = t->fn[a_port][0]; - fn[1] = t->fn[1 - a_port][1]; - return 2; + fn[1] = nlanes == 2 ? t->fn[1 - a_port][1] : NULL; + return nlanes; } diff --git a/transport-core/tests/test_planning.py b/transport-core/tests/test_planning.py index 0a8f9cd..47c8b05 100644 --- a/transport-core/tests/test_planning.py +++ b/transport-core/tests/test_planning.py @@ -97,8 +97,10 @@ def test_topology_refuses_what_it_would_have_guessed(self): ("hosts a b\ncabling explicit\ncable -0.port0 1.port1\n", "a cable is"), # a sign ("hosts a b\ncabling explicit\ncable 0.port0 1.port1 2.port0\n", "a cable is"), ("hosts a b\ncabling explicit\ncable 0.port0 7.port1\n", "outside 0-1"), - ("hosts a b\ncabling path\nport0 only_one\n", "requires exactly two"), - ("hosts a b\ncabling path\nport1 a b c\n", "requires exactly two"), + ("hosts a b\ncabling path\nport0 only_one\n", "same number of functions"), + ("hosts a b\ncabling path\nport0 only_one\nport1 a b\n", "same number of functions"), + ("hosts a b\ncabling path\nport0\n", "requires one or two"), + ("hosts a b\ncabling path\nport1 a b c\n", "requires one or two"), ("hosts a b\ncabling path\nport0 ok bad/name\n", "invalid device identifier"), ("hosts a b\ncabling path\nport0 ok " + "f" * 64 + "\n", "invalid device identifier"), (f"hosts a {long_name}\ncabling path\n", "longer than 63 characters"), # was silently cut short @@ -126,6 +128,8 @@ def test_topology_accepts_the_documented_forms(self): "hosts a b c\ncabling explicit\ncable 2.port0 0.port1\ncable 1.port1 0.port0\n", "hosts a b\ncabling path\nport0 emu0 emu1\nport1 emu0 emu1\n", # aliased names: emulation "hosts a b\ncabling path\nport0 mlx5_0 mlx5-1.a:b\nport1 _x y\n", + "hosts a b c d\ncabling ring\nport0 mlx5_0\nport1 mlx5_1\n", + "hosts a b c\ncabling path\nport0 emu0\nport1 emu0\n", f"hosts a {sixty_three}\ncabling path\n", f"hosts {many}\ncabling ring\n", "hosts a b\ncabling path\n# " + "x" * 1019, # a full last line without a line end