#[non_exhaustive]pub struct RuntimeConfig {
pub model_dir: Option<PathBuf>,
pub ort_dylib: Option<PathBuf>,
pub intra_threads: usize,
pub sessions_per_model: usize,
}Expand description
How the shared layer resolves files and sizes its pools.
§Threads
intra_threads x sessions_per_model x the caller’s page parallelism
should not exceed the cores; one caller-facing thread budget (later, the
CLI’s --threads) drives both numbers. There is no automatic pool sizing:
what is set here is what runs.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.model_dir: Option<PathBuf>Explicit model dir; wins over the env var and the default. Model
files only: the runtime library never reads this field (see
resolve_ort_dylib).
ort_dylib: Option<PathBuf>Explicit ONNX Runtime library; wins over the env var and the default.
intra_threads: usizeONNX Runtime intra-op threads per session. Default 4.
sessions_per_model: usizeSessions per model: a pool so parallel pages/tables do not serialise
on one Mutex. Default 1. 0 is clamped to 1 (see below).
Implementations§
Source§impl RuntimeConfig
impl RuntimeConfig
Sourcepub fn new() -> RuntimeConfig
pub fn new() -> RuntimeConfig
A default config: 4 intra threads, a pool of 1, resolved paths.
Sourcepub fn with_model_dir(self, dir: impl Into<PathBuf>) -> RuntimeConfig
pub fn with_model_dir(self, dir: impl Into<PathBuf>) -> RuntimeConfig
Set the explicit model dir; wins over everything.
Sourcepub fn with_ort_dylib(self, lib: impl Into<PathBuf>) -> RuntimeConfig
pub fn with_ort_dylib(self, lib: impl Into<PathBuf>) -> RuntimeConfig
Set the explicit ONNX Runtime library; wins over everything.
Sourcepub fn with_intra_threads(self, threads: usize) -> RuntimeConfig
pub fn with_intra_threads(self, threads: usize) -> RuntimeConfig
Set the ONNX Runtime intra-op threads per session.
Sourcepub fn with_sessions_per_model(self, sessions: usize) -> RuntimeConfig
pub fn with_sessions_per_model(self, sessions: usize) -> RuntimeConfig
Set the sessions per model.
A pool so parallel pages/tables do not serialise on one Mutex;
SharedSession::run blocks until a session is free. 0 would block
forever (a pool that can never hold a session), so it is clamped to 1
when the pool is built – the only automatic sizing in this module, and
a degenerate-input guard rather than a policy.
Trait Implementations§
Source§impl Default for RuntimeConfig
impl Default for RuntimeConfig
Source§fn default() -> RuntimeConfig
fn default() -> RuntimeConfig
Auto Trait Implementations§
impl Freeze for RuntimeConfig
impl RefUnwindSafe for RuntimeConfig
impl Send for RuntimeConfig
impl Sync for RuntimeConfig
impl Unpin for RuntimeConfig
impl UnsafeUnpin for RuntimeConfig
impl UnwindSafe for RuntimeConfig
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().