Neighbors Cagra Module

View as Markdown

Rust module: cuvs::neighbors::cagra

Source: rust/cuvs/src/neighbors/cagra/mod.rs

CAGRA: a graph-based approximate nearest neighbors algorithm with state-of-the-art query throughput for both small and large batch sizes.

Build an [Index] from a dataset, then search it with device-resident queries and output buffers. Tensors are passed through the AsDlTensor / AsDlTensorMut traits; see the dlpack module for the tensor model and examples/cagra.rs for a complete, runnable example.

Parameter types ([IndexParams], [SearchParams], …) use the [bon] builder pattern: every setter is optional and unset values keep the cuVS C library defaults. Values are validated when the builder’s build() runs, returning [CagraError::Validation] for out-of-range inputs.

crate::neighbors::filters::{Bitset, Filter}

pub use crate::neighbors::filters::{Bitset, Filter};

Source: rust/cuvs/src/neighbors/cagra/mod.rs:23

index::Index

pub use index::Index;

Source: rust/cuvs/src/neighbors/cagra/mod.rs:24

params::{CompressionParams, IndexParams, SearchParams}

pub use params::{CompressionParams, IndexParams, SearchParams};

Source: rust/cuvs/src/neighbors/cagra/mod.rs:25

GraphBuildAlgo

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[non_exhaustive]
pub enum GraphBuildAlgo {
/* variants omitted */
}

Algorithm for building the internal k-NN graph.

Source: rust/cuvs/src/neighbors/cagra/mod.rs:33

SearchAlgo

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[non_exhaustive]
pub enum SearchAlgo {
/* variants omitted */
}

Search kernel implementation.

Source: rust/cuvs/src/neighbors/cagra/mod.rs:73

HashMode

#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
#[non_exhaustive]
pub enum HashMode {
/* variants omitted */
}

Hash-table mode used during search.

Source: rust/cuvs/src/neighbors/cagra/mod.rs:109

CagraError

#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum CagraError {
/* variants omitted */
}

Error type for CAGRA operations.

Source: rust/cuvs/src/neighbors/cagra/mod.rs:141