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
impl Cluster
pub fn from_config(cfg: ClusterConfig) -> Self
pub fn from_path(p: impl AsRef<Path>) -> Result<Self>
Sourcepub fn probe(&mut self, remote_bin: &str) -> Result<&[NodeCaps]>
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.
Sourcepub fn plan(&mut self, model: ModelCost) -> Result<&[Assignment]>
pub fn plan(&mut self, model: ModelCost) -> Result<&[Assignment]>
Plan placement from the model cost model + probed caps (probe first).
Sourcepub fn worker_argv(&self, i: usize) -> Vec<String>
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.
Sourcepub fn launch(&self, remote_bin: &str) -> Result<Vec<Child>>
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.
Sourcepub fn drive(&self, inputs: Vec<NamedTensor>) -> Result<ClusterRun>
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§
impl Freeze for Cluster
impl RefUnwindSafe for Cluster
impl Send for Cluster
impl Sync for Cluster
impl Unpin for Cluster
impl UnsafeUnpin for Cluster
impl UnwindSafe for Cluster
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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