GpuEmbeddingAccelerator

Struct GpuEmbeddingAccelerator 

Source
pub struct GpuEmbeddingAccelerator { /* private fields */ }
Expand description

Enhanced GPU-accelerated embedding computations with memory pooling and adaptive batching

Implementations§

Source§

impl GpuEmbeddingAccelerator

Source

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

Source

pub async fn get_optimal_batch_size(&self, data_size: usize) -> usize

Get optimal batch size based on recent performance

Source

pub async fn update_batch_size_feedback( &self, _batch_size: usize, performance_score: f32, )

Update optimal batch size based on performance feedback

Source

pub fn batch_l2_distances_gpu( &self, vectors_a: &[Array1<f64>], vectors_b: &[Array1<f64>], ) -> Result<Vec<f64>, GpuError>

GPU-accelerated batch distance computation

Source

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

Source

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

Source

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

Source

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

High-performance embedding search with GPU acceleration

Source

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

Source

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

Source

pub fn device_info(&self) -> String

Get GPU device info

Source

pub fn available_memory(&self) -> Result<u64, GpuError>

Get available GPU memory Note: Currently using placeholder until scirs2_linalg::gpu is available

Source

pub async fn get_performance_report(&self) -> GpuPerformanceReport

GPU memory and performance monitoring

Source

pub fn reset_performance_stats(&self)

Reset performance statistics

Source

pub fn get_memory_pool_status(&self) -> (usize, u64, u64)

Get current memory pool status

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.