pub struct HostBuilder { /* private fields */ }Expand description
Fluent builder for one FullWorker. Borrows the parent
ClusterBuilder so Self::done can return to chaining
additional hosts.
Implementations§
Source§impl HostBuilder
impl HostBuilder
Sourcepub fn ranks<I: IntoIterator<Item = usize>>(self, ranks: I) -> Self
pub fn ranks<I: IntoIterator<Item = usize>>(self, ranks: I) -> Self
Global rank indices owned by this host.
Sourcepub fn devices<I: IntoIterator<Item = u8>>(self, devices: I) -> Self
pub fn devices<I: IntoIterator<Item = u8>>(self, devices: I) -> Self
Explicit CUDA device indices for this host’s ranks, paired by
position with ranks. Length must match ranks at
ClusterBuilder::build time.
Sourcepub fn all_devices(self) -> Self
pub fn all_devices(self) -> Self
Use ALL visible CUDA devices on this host (resolved at startup
on the host that owns this entry). Equivalent to the yml
shorthand local_devices: "all".
Sourcepub fn nccl_socket_ifname(self, name: impl Into<String>) -> Self
pub fn nccl_socket_ifname(self, name: impl Into<String>) -> Self
Network interface NCCL binds to (e.g. "virbr0", "enp1s0",
"lo" for single-host loopback).
Sourcepub fn path(self, p: impl Into<String>) -> Self
pub fn path(self, p: impl Into<String>) -> Self
Project checkout path on this host. Launcher cd’s here before invoking the remote command.
Sourcepub fn arch(self, p: impl Into<String>) -> Self
pub fn arch(self, p: impl Into<String>) -> Self
libtorch variant subpath under <path>/libtorch/ on this host
(e.g. "precompiled/cu128", "builds/sm61-sm120"). Convention
resolves the runtime libtorch at <path>/libtorch/<arch>/.
Sourcepub fn ssh(self, target: impl Into<String>) -> Self
pub fn ssh(self, target: impl Into<String>) -> Self
SSH target (e.g. "user@host" or a short alias from
~/.ssh/config). Default: the host’s name. Set to a
different value when the SSH connect string differs from the
cluster name (e.g. ~/.ssh/config host aliases). Mirrors the
YAML field ssh.target.
Sourcepub fn ssh_user(self, user: impl Into<String>) -> Self
pub fn ssh_user(self, user: impl Into<String>) -> Self
SSH login user (-l <user>). Default: current user. Mirrors
ssh.user.
Sourcepub fn ssh_identity_file(self, path: impl Into<String>) -> Self
pub fn ssh_identity_file(self, path: impl Into<String>) -> Self
SSH identity file (-i <path>). Mirrors ssh.identity_file.
Sourcepub fn ssh_option(self, opt: impl Into<String>) -> Self
pub fn ssh_option(self, opt: impl Into<String>) -> Self
Append one -o Key=Value SSH option. Call multiple times to
accumulate options in order (e.g. .ssh_option("ProxyJump=bastion"),
.ssh_option("StrictHostKeyChecking=no")). Mirrors
ssh.options[].
Sourcepub fn tunnel(self, tunnel: bool) -> Self
pub fn tunnel(self, tunnel: bool) -> Self
Route this host’s training traffic through its fan-out SSH
session (remote forward) instead of a direct TCP connection to
the controller. Requires a CPU ElChe mode and a remote host —
validated loudly at launch. Mirrors the YAML field tunnel:.
Sourcepub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Set a host-scoped env var exported into every rank child spawned
on this host. Mirrors the YAML per-worker env: block; overrides
matching keys from the cluster-scope ClusterBuilder::env.
Useful for host-specific tuning (e.g. a different
NCCL_SOCKET_IFNAME or a custom LD_LIBRARY_PATH for a
non-standard CUDA install). Call repeatedly to accumulate; a
later call with the same key wins.
Sourcepub fn done(self) -> ClusterBuilder
pub fn done(self) -> ClusterBuilder
Finalize this host and return to the cluster builder.
Missing required fields (ranks, local_devices,
nccl_socket_ifname, path) do NOT panic: they are recorded and
surfaced as a single Err by ClusterBuilder::build, keeping
the fluent chain infallible while user-input mistakes stay loud.