pub struct MemoryCalculator<T: IsFloat + Debug + Copy + Clone> { /* private fields */ }Expand description
Wrapper that manages storage of matrices and custom kernels and manages calculation operations.
Implementations§
Source§impl<T: IsFloat + Debug + Copy + Clone> MemoryCalculator<T>
impl<T: IsFloat + Debug + Copy + Clone> MemoryCalculator<T>
Sourcepub fn store_matrix(&mut self, matrix: Matrix<T>) -> Result<usize>
pub fn store_matrix(&mut self, matrix: Matrix<T>) -> Result<usize>
Store matrix to calculator and gpu memory.
Source§impl MemoryCalculator<f32>
impl MemoryCalculator<f32>
Sourcepub fn init() -> Result<MemoryCalculator<f32>>
pub fn init() -> Result<MemoryCalculator<f32>>
Initializes Calculator struct.
Sourcepub fn mat_mul(
&mut self,
left_idx: usize,
right_idx: usize,
) -> Result<(Matrix<f32>, usize)>
pub fn mat_mul( &mut self, left_idx: usize, right_idx: usize, ) -> Result<(Matrix<f32>, usize)>
Multiply Matrix and Matrix.
Sourcepub unsafe fn load_custom_fn(
&mut self,
program_source: &str,
kernel_name: &str,
parameter_fn: MemoryParameterFunction<f32>,
) -> Result<usize>
pub unsafe fn load_custom_fn( &mut self, program_source: &str, kernel_name: &str, parameter_fn: MemoryParameterFunction<f32>, ) -> Result<usize>
Compile and store a custom kernel and build/store a closure to execute said kernel.
Source§impl MemoryCalculator<f64>
impl MemoryCalculator<f64>
Sourcepub fn init() -> Result<MemoryCalculator<f64>>
pub fn init() -> Result<MemoryCalculator<f64>>
Initializes Calculator struct.
Sourcepub fn mat_mul(
&mut self,
left_idx: usize,
right_idx: usize,
) -> Result<(Matrix<f64>, usize)>
pub fn mat_mul( &mut self, left_idx: usize, right_idx: usize, ) -> Result<(Matrix<f64>, usize)>
Multiply Matrix and Matrix.
Sourcepub unsafe fn load_custom_fn(
&mut self,
program_source: &str,
kernel_name: &str,
parameter_fn: MemoryParameterFunction<f64>,
) -> Result<usize>
pub unsafe fn load_custom_fn( &mut self, program_source: &str, kernel_name: &str, parameter_fn: MemoryParameterFunction<f64>, ) -> Result<usize>
Compile and store a custom kernel and build/store a closure to execute said kernel.
Auto Trait Implementations§
impl<T> Freeze for MemoryCalculator<T>
impl<T> !RefUnwindSafe for MemoryCalculator<T>
impl<T> !Send for MemoryCalculator<T>
impl<T> !Sync for MemoryCalculator<T>
impl<T> Unpin for MemoryCalculator<T>where
T: Unpin,
impl<T> !UnwindSafe for MemoryCalculator<T>
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
Mutably borrows from an owned value. Read more