pub struct GpuEmbeddingAccelerator { /* private fields */ }Expand description
Enhanced GPU-accelerated embedding computations with memory pooling and adaptive batching
Implementations§
Source§impl GpuEmbeddingAccelerator
impl GpuEmbeddingAccelerator
Sourcepub fn new(device_id: u32) -> Result<Self, GpuError>
pub fn new(device_id: u32) -> Result<Self, GpuError>
Create a new enhanced GPU accelerator with memory pooling and adaptive batching Note: Currently using placeholder until scirs2_linalg::gpu is available
Sourcepub async fn get_optimal_batch_size(&self, data_size: usize) -> usize
pub async fn get_optimal_batch_size(&self, data_size: usize) -> usize
Get optimal batch size based on recent performance
Sourcepub async fn update_batch_size_feedback(
&self,
_batch_size: usize,
performance_score: f32,
)
pub async fn update_batch_size_feedback( &self, _batch_size: usize, performance_score: f32, )
Update optimal batch size based on performance feedback
Sourcepub fn batch_l2_distances_gpu(
&self,
vectors_a: &[Array1<f64>],
vectors_b: &[Array1<f64>],
) -> Result<Vec<f64>, GpuError>
pub fn batch_l2_distances_gpu( &self, vectors_a: &[Array1<f64>], vectors_b: &[Array1<f64>], ) -> Result<Vec<f64>, GpuError>
GPU-accelerated batch distance computation
Sourcepub fn cosine_similarity_matrix_gpu(
&self,
vectors: &[Array1<f64>],
) -> Result<Array2<f64>, GpuError>
pub fn cosine_similarity_matrix_gpu( &self, vectors: &[Array1<f64>], ) -> Result<Array2<f64>, GpuError>
GPU-accelerated cosine similarity matrix Note: Currently using CPU fallback until scirs2_linalg::gpu is available
Sourcepub fn batch_gradient_update_gpu(
&self,
embeddings: &mut [Array2<f64>],
gradients: &[Array2<f64>],
learning_rate: f64,
l2_reg: f64,
) -> Result<(), GpuError>
pub fn batch_gradient_update_gpu( &self, embeddings: &mut [Array2<f64>], gradients: &[Array2<f64>], learning_rate: f64, l2_reg: f64, ) -> Result<(), GpuError>
GPU-accelerated gradient updates for large embedding matrices Note: Currently using CPU fallback until scirs2_linalg::gpu is available
Sourcepub async fn adaptive_batch_processing<T, R>(
&self,
data: &[T],
process_fn: impl FnMut(&[T]) -> Result<Vec<R>, GpuError>,
) -> Result<Vec<R>, GpuError>
pub async fn adaptive_batch_processing<T, R>( &self, data: &[T], process_fn: impl FnMut(&[T]) -> Result<Vec<R>, GpuError>, ) -> Result<Vec<R>, GpuError>
Advanced GPU-accelerated adaptive batch processing with memory pooling
Sourcepub async fn optimized_matrix_multiply(
&self,
a: &Array2<f32>,
b: &Array2<f32>,
) -> Result<Array2<f32>, GpuError>
pub async fn optimized_matrix_multiply( &self, a: &Array2<f32>, b: &Array2<f32>, ) -> Result<Array2<f32>, GpuError>
GPU-accelerated matrix multiplication with memory reuse Note: Currently using CPU fallback until scirs2_linalg::gpu is available
Sourcepub async fn gpu_embedding_search(
&self,
query_embedding: &Array1<f32>,
database_embeddings: &[Array1<f32>],
top_k: usize,
) -> Result<Vec<(usize, f32)>, GpuError>
pub async fn gpu_embedding_search( &self, query_embedding: &Array1<f32>, database_embeddings: &[Array1<f32>], top_k: usize, ) -> Result<Vec<(usize, f32)>, GpuError>
High-performance embedding search with GPU acceleration
Sourcepub fn xavier_init_gpu(
&self,
shapes: &[(usize, usize)],
fan_in: usize,
fan_out: usize,
seed: u64,
) -> Result<Vec<Array2<f64>>, GpuError>
pub fn xavier_init_gpu( &self, shapes: &[(usize, usize)], fan_in: usize, fan_out: usize, seed: u64, ) -> Result<Vec<Array2<f64>>, GpuError>
GPU-accelerated Xavier initialization for large embedding matrices Note: Currently using CPU fallback until scirs2_linalg::gpu is available
Sourcepub fn contrastive_learning_gpu(
&self,
_entity_embeddings: &mut [Array1<f32>],
_similarity_pairs: &[(usize, usize)],
_negative_samples: &[(usize, usize)],
_temperature: f32,
_learning_rate: f32,
) -> Result<f32, GpuError>
pub fn contrastive_learning_gpu( &self, _entity_embeddings: &mut [Array1<f32>], _similarity_pairs: &[(usize, usize)], _negative_samples: &[(usize, usize)], _temperature: f32, _learning_rate: f32, ) -> Result<f32, GpuError>
GPU-accelerated contrastive learning updates Note: Currently using CPU fallback until scirs2_linalg::gpu is available
Sourcepub fn device_info(&self) -> String
pub fn device_info(&self) -> String
Get GPU device info
Sourcepub fn available_memory(&self) -> Result<u64, GpuError>
pub fn available_memory(&self) -> Result<u64, GpuError>
Get available GPU memory Note: Currently using placeholder until scirs2_linalg::gpu is available
Sourcepub async fn get_performance_report(&self) -> GpuPerformanceReport
pub async fn get_performance_report(&self) -> GpuPerformanceReport
GPU memory and performance monitoring
Sourcepub fn reset_performance_stats(&self)
pub fn reset_performance_stats(&self)
Reset performance statistics
Sourcepub fn get_memory_pool_status(&self) -> (usize, u64, u64)
pub fn get_memory_pool_status(&self) -> (usize, u64, u64)
Get current memory pool status
Auto Trait Implementations§
impl Freeze for GpuEmbeddingAccelerator
impl RefUnwindSafe for GpuEmbeddingAccelerator
impl Send for GpuEmbeddingAccelerator
impl Sync for GpuEmbeddingAccelerator
impl Unpin for GpuEmbeddingAccelerator
impl UnwindSafe for GpuEmbeddingAccelerator
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
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
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>
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>
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 moreSource§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
Source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
Source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
Source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
Source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Source§impl<T> StrictAs for T
impl<T> StrictAs for T
Source§fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
fn strict_as<Dst>(self) -> Dstwhere
T: StrictCast<Dst>,
Source§impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
impl<Src, Dst> StrictCastFrom<Src> for Dstwhere
Src: StrictCast<Dst>,
Source§fn strict_cast_from(src: Src) -> Dst
fn strict_cast_from(src: Src) -> Dst
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.