Skip to main content

Module instance

Module instance 

Source
Expand description

Who else is already running a model on this box.

One ferrox process holding a model saturates the machine by design: prefill is a dense GEMM across every core, and the decode pool spins. Two of them do not run at half speed each – they thrash, and the numbers both of them report become meaningless. The same is true of a ferrox-server left running in another terminal while a benchmark starts.

So a model-loading process registers itself here first, and by default refuses to start when another live instance already holds one. The registry is a directory of one small file per process:

$FERROX_INSTANCE_DIR (default ~/.cache/ferrox/instances)/<pid>

This is advisory, not a lock. Two processes starting in the same instant can each see the other and both refuse – which is the safe direction – but nothing here prevents a determined caller from running two models. It exists to stop the accident, not to enforce a policy against the operator.

Structs§

InstanceConflict
Another live instance already holds a model.
InstanceGuard
Removes this process’s registry entry when it drops.
InstanceInfo
One live ferrox process, as it described itself at startup.

Enums§

InstancePolicy
Whether a second model-loading process may start.

Functions§

current_backend
The accelerator this process would actually use, for the registry entry. Compiled-in features only decide what is possible; the runtime toggles decide what is enabled, so both are consulted.
live_instances
Every registered instance whose process is still alive, excluding this one. Entries for dead processes are deleted as they are found.
register
Registers this process and enforces policy.
registry_dir
Where the per-process files live. FERROX_INSTANCE_DIR overrides.