pub struct GpuBatchProcessor { /* private fields */ }Expand description
GPU batch processor for distance calculations.
This processor automatically dispatches to GPU or CPU based on batch size and GPU availability.
Implementations§
Source§impl GpuBatchProcessor
impl GpuBatchProcessor
Sourcepub fn new(config: GpuConfig) -> Result<Self>
pub fn new(config: GpuConfig) -> Result<Self>
Create a new GPU batch processor.
Returns error if GPU is requested but not available.
Sourcepub fn is_gpu_available(&self) -> bool
pub fn is_gpu_available(&self) -> bool
Check if GPU is available and enabled.
Sourcepub fn batch_distance(
&self,
queries: &[Vec<f32>],
vectors: &[Vec<f32>],
metric: DistanceMetric,
) -> Result<Vec<Vec<f32>>>
pub fn batch_distance( &self, queries: &[Vec<f32>], vectors: &[Vec<f32>], metric: DistanceMetric, ) -> Result<Vec<Vec<f32>>>
Compute batch distances between queries and vectors.
Automatically dispatches to GPU or CPU based on batch size and availability.
§Arguments
queries- Query vectors (N queries x D dimensions)vectors- Database vectors (M vectors x D dimensions)metric- Distance metric to use
§Returns
A 2D matrix of distances (N x M), where result[i][j] is the distance from query i to vector j.
Auto Trait Implementations§
impl Freeze for GpuBatchProcessor
impl RefUnwindSafe for GpuBatchProcessor
impl Send for GpuBatchProcessor
impl Sync for GpuBatchProcessor
impl Unpin for GpuBatchProcessor
impl UnwindSafe for GpuBatchProcessor
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