Skip to main content

Cluster

Struct Cluster 

Source
pub struct Cluster {
    pub cfg: ClusterConfig,
    pub caps: Vec<NodeCaps>,
    pub plan: Vec<Assignment>,
}
Expand description

A configured, probed, planned cluster.

Fields§

§cfg: ClusterConfig§caps: Vec<NodeCaps>

Probed hardware, one per node (same order as cfg.nodes). Empty until Cluster::probe.

§plan: Vec<Assignment>

Layer→node plan. Empty until Cluster::plan.

Implementations§

Source§

impl Cluster

Source

pub fn from_config(cfg: ClusterConfig) -> Self

Source

pub fn from_path(p: impl AsRef<Path>) -> Result<Self>

Source

pub fn probe(&mut self, remote_bin: &str) -> Result<&[NodeCaps]>

Probe every node’s hardware. remote_bin is the worker binary path on the remote hosts (its --probe mode self-reports); nodes without ssh are probed locally.

Source

pub fn plan(&mut self, model: ModelCost) -> Result<&[Assignment]>

Plan placement from the model cost model + probed caps (probe first).

Source

pub fn worker_argv(&self, i: usize) -> Vec<String>

The worker command-line for node i from its plan + config — so the model crate’s worker binary honours device / precision / rng / kv / layers.

Source

pub fn launch(&self, remote_bin: &str) -> Result<Vec<Child>>

Spawn a worker process per node (ssh for remote, local otherwise). The caller drives them via Cluster::drive, then reaps the children.

Source

pub fn drive(&self, inputs: Vec<NamedTensor>) -> Result<ClusterRun>

Drive one forward through the planned stages, timing each, and collect the output. inputs seeds the first stage (e.g. input_ids). Boundary tensor name is hidden/hidden_in per the model’s stage I/O convention.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.