From 3eec2c3ac33a36f68011d26e3208633dd1fcabe3 Mon Sep 17 00:00:00 2001 From: Ben Frederickson Date: Mon, 4 Mar 2024 09:38:55 -0800 Subject: [PATCH] update to latest 24.04 cagra api --- rust/cuvs-sys/cuvs_c_wrapper.h | 2 +- rust/cuvs-sys/src/lib.rs | 6 +++--- rust/cuvs/src/cagra/index.rs | 12 ++++++------ rust/cuvs/src/cagra/index_params.rs | 2 +- rust/cuvs/src/cagra/search_params.rs | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/rust/cuvs-sys/cuvs_c_wrapper.h b/rust/cuvs-sys/cuvs_c_wrapper.h index 40d50e9a4..ccca82632 100644 --- a/rust/cuvs-sys/cuvs_c_wrapper.h +++ b/rust/cuvs-sys/cuvs_c_wrapper.h @@ -17,4 +17,4 @@ // wrapper file containing all the C-API's we should automatically be creating rust // bindings for #include -#include +#include diff --git a/rust/cuvs-sys/src/lib.rs b/rust/cuvs-sys/src/lib.rs index e3473f77e..8a261a052 100644 --- a/rust/cuvs-sys/src/lib.rs +++ b/rust/cuvs-sys/src/lib.rs @@ -33,13 +33,13 @@ mod tests { #[test] fn test_create_cagra_index() { unsafe { - let mut index = core::mem::MaybeUninit::::uninit(); + let mut index = core::mem::MaybeUninit::::uninit(); assert_eq!( - cagraIndexCreate(index.as_mut_ptr()), + cuvsCagraIndexCreate(index.as_mut_ptr()), cuvsError_t::CUVS_SUCCESS ); let index = index.assume_init(); - assert_eq!(cagraIndexDestroy(index), cuvsError_t::CUVS_SUCCESS); + assert_eq!(cuvsCagraIndexDestroy(index), cuvsError_t::CUVS_SUCCESS); } } diff --git a/rust/cuvs/src/cagra/index.rs b/rust/cuvs/src/cagra/index.rs index 25a54d095..43f032676 100644 --- a/rust/cuvs/src/cagra/index.rs +++ b/rust/cuvs/src/cagra/index.rs @@ -22,7 +22,7 @@ use crate::error::{check_cuvs, Result}; use crate::resources::Resources; #[derive(Debug)] -pub struct Index(ffi::cagraIndex_t); +pub struct Index(ffi::cuvsCagraIndex_t); impl Index { /// Builds a new index @@ -34,7 +34,7 @@ impl Index { let dataset: ManagedTensor = dataset.into(); let index = Index::new()?; unsafe { - check_cuvs(ffi::cagraBuild(res.0, params.0, dataset.as_ptr(), index.0))?; + check_cuvs(ffi::cuvsCagraBuild(res.0, params.0, dataset.as_ptr(), index.0))?; } Ok(index) } @@ -42,8 +42,8 @@ impl Index { /// Creates a new empty index pub fn new() -> Result { unsafe { - let mut index = core::mem::MaybeUninit::::uninit(); - check_cuvs(ffi::cagraIndexCreate(index.as_mut_ptr()))?; + let mut index = core::mem::MaybeUninit::::uninit(); + check_cuvs(ffi::cuvsCagraIndexCreate(index.as_mut_ptr()))?; Ok(Index(index.assume_init())) } } @@ -57,7 +57,7 @@ impl Index { distances: &ManagedTensor, ) -> Result<()> { unsafe { - check_cuvs(ffi::cagraSearch( + check_cuvs(ffi::cuvsCagraSearch( res.0, params.0, self.0, @@ -71,7 +71,7 @@ impl Index { impl Drop for Index { fn drop(&mut self) { - if let Err(e) = check_cuvs(unsafe { ffi::cagraIndexDestroy(self.0) }) { + if let Err(e) = check_cuvs(unsafe { ffi::cuvsCagraIndexDestroy(self.0) }) { write!(stderr(), "failed to call cagraIndexDestroy {:?}", e) .expect("failed to write to stderr"); } diff --git a/rust/cuvs/src/cagra/index_params.rs b/rust/cuvs/src/cagra/index_params.rs index 4d2e57c35..656ab4a9c 100644 --- a/rust/cuvs/src/cagra/index_params.rs +++ b/rust/cuvs/src/cagra/index_params.rs @@ -18,7 +18,7 @@ use crate::error::{check_cuvs, Result}; use std::fmt; use std::io::{stderr, Write}; -pub type BuildAlgo = ffi::cagraGraphBuildAlgo; +pub type BuildAlgo = ffi::cuvsCagraGraphBuildAlgo; /// Supplemental parameters to build CAGRA Index pub struct IndexParams(pub ffi::cuvsCagraIndexParams_t); diff --git a/rust/cuvs/src/cagra/search_params.rs b/rust/cuvs/src/cagra/search_params.rs index d32d6783c..11ac92bdd 100644 --- a/rust/cuvs/src/cagra/search_params.rs +++ b/rust/cuvs/src/cagra/search_params.rs @@ -18,8 +18,8 @@ use crate::error::{check_cuvs, Result}; use std::fmt; use std::io::{stderr, Write}; -pub type SearchAlgo = ffi::cagraSearchAlgo; -pub type HashMode = ffi::cagraHashMode; +pub type SearchAlgo = ffi::cuvsCagraSearchAlgo; +pub type HashMode = ffi::cuvsCagraHashMode; /// Supplemental parameters to search CAGRA index pub struct SearchParams(pub ffi::cuvsCagraSearchParams_t);