Skip to main content

HostBuilder

Struct HostBuilder 

Source
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

Source

pub fn ranks<I: IntoIterator<Item = usize>>(self, ranks: I) -> Self

Global rank indices owned by this host.

Source

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.

Source

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".

Source

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).

Source

pub fn path(self, p: impl Into<String>) -> Self

Project checkout path on this host. Launcher cd’s here before invoking the remote command.

Source

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>/.

Source

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.

Source

pub fn ssh_port(self, port: u16) -> Self

SSH port (-p <port>). Default: 22. Mirrors ssh.port.

Source

pub fn ssh_user(self, user: impl Into<String>) -> Self

SSH login user (-l <user>). Default: current user. Mirrors ssh.user.

Source

pub fn ssh_identity_file(self, path: impl Into<String>) -> Self

SSH identity file (-i <path>). Mirrors ssh.identity_file.

Source

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[].

Source

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:.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.