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}

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

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

index::Index

1pub use index::Index;

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

params::{CompressionParams, IndexParams, SearchParams}

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

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

GraphBuildAlgo

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

Algorithm for building the internal k-NN graph.

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

SearchAlgo

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

Search kernel implementation.

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

HashMode

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

Hash-table mode used during search.

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

CagraError

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

Error type for CAGRA operations.

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