pub struct Backend { /* private fields */ }Expand description
Opaque compute backend handle.
Create once and share between Comparator and Scorer so both use the
same underlying GPU device.
use zer_lib::prelude::*;
let schema = SchemaBuilder::new().field("naam", FieldKind::Name).build().unwrap();
let backend = Backend::auto_detect();
let comparator = Comparator::new(&schema, &backend);
let scorer = Scorer::new(&backend);Implementations§
Source§impl Backend
impl Backend
Sourcepub fn auto_detect() -> Self
pub fn auto_detect() -> Self
Read --target=<name> from process args and return the matching backend.
Falls back to CPU when the flag is absent, no hardware probing.
Pass --target=auto to restore the hardware-detection order
(CUDA → Vulkan → AVX2 → CPU).
Sourcepub fn from_target(target: &str) -> Self
pub fn from_target(target: &str) -> Self
Select a backend by name, called by auto_detect() to resolve --target=<name>.
Accepted values: "auto" (hardware-detect), "cpu", "cuda", "avx2", "vulkan".
Exits with a diagnostic if the target is unknown, not compiled in, or hardware init fails.
Auto Trait Implementations§
impl Freeze for Backend
impl RefUnwindSafe for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl UnsafeUnpin for Backend
impl UnwindSafe for Backend
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
Mutably borrows from an owned value. Read more
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>
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 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>
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