pub struct GpuSearchBackend { /* private fields */ }Expand description
GPU search backend that manages vector data on the GPU.
When the gpu feature is enabled, this backend wraps a real
rustyhdf5_gpu::GpuAccelerator for hardware-accelerated search.
Falls back to CPU SIMD search when GPU is unavailable.
Implementations§
Source§impl GpuSearchBackend
impl GpuSearchBackend
Sourcepub fn try_init(
vectors: &[Vec<f32>],
norms: &[f32],
dim: usize,
threshold: usize,
) -> Self
pub fn try_init( vectors: &[Vec<f32>], norms: &[f32], dim: usize, threshold: usize, ) -> Self
Attempt to initialize GPU backend.
Returns a backend with GPU active only if hardware is detected,
the gpu feature is enabled, and the collection size exceeds the threshold.
Sourcepub fn is_available(&self) -> bool
pub fn is_available(&self) -> bool
Check if GPU acceleration is active.
Sourcepub fn re_upload(&mut self, vectors: &[Vec<f32>], norms: &[f32])
pub fn re_upload(&mut self, vectors: &[Vec<f32>], norms: &[f32])
Re-upload vectors after mutation (save/compact).
Sourcepub fn search_cosine(
&self,
query: &[f32],
vectors: &[Vec<f32>],
norms: &[f32],
tombstones: &[u8],
k: usize,
) -> Vec<(usize, f32)>
pub fn search_cosine( &self, query: &[f32], vectors: &[Vec<f32>], norms: &[f32], tombstones: &[u8], k: usize, ) -> Vec<(usize, f32)>
Search using GPU-accelerated cosine similarity.
If GPU is not available, falls back to CPU SIMD prenorm search.
Sourcepub fn search_l2(
&self,
query: &[f32],
vectors: &[Vec<f32>],
tombstones: &[u8],
k: usize,
) -> Vec<(usize, f32)>
pub fn search_l2( &self, query: &[f32], vectors: &[Vec<f32>], tombstones: &[u8], k: usize, ) -> Vec<(usize, f32)>
Search using GPU-accelerated L2 distance.
Sourcepub fn device_info(&self) -> String
pub fn device_info(&self) -> String
Get the device info string (for metrics/logging).
Auto Trait Implementations§
impl Freeze for GpuSearchBackend
impl RefUnwindSafe for GpuSearchBackend
impl Send for GpuSearchBackend
impl Sync for GpuSearchBackend
impl Unpin for GpuSearchBackend
impl UnsafeUnpin for GpuSearchBackend
impl UnwindSafe for GpuSearchBackend
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> 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