pub struct CpuBackend { /* private fields */ }Expand description
CPU fallback compute backend.
Stores buffers as Vecf64` in memory and dispatches kernels on the CPU.
Implementations§
Source§impl CpuBackend
impl CpuBackend
Sourcepub fn num_buffers(&self) -> usize
pub fn num_buffers(&self) -> usize
Return the number of buffers currently allocated.
Sourcepub fn total_elements(&self) -> usize
pub fn total_elements(&self) -> usize
Return the total number of f64 elements across all buffers.
Trait Implementations§
Source§impl ComputeBackend for CpuBackend
impl ComputeBackend for CpuBackend
Source§fn create_buffer(&self, size: usize) -> BufferHandle
fn create_buffer(&self, size: usize) -> BufferHandle
Allocate a buffer that can hold
size f64 elements.Source§fn write_buffer(&self, handle: BufferHandle, data: &[f64])
fn write_buffer(&self, handle: BufferHandle, data: &[f64])
Write
data into the buffer referenced by handle.Source§fn read_buffer(&self, handle: BufferHandle) -> Vec<f64>
fn read_buffer(&self, handle: BufferHandle) -> Vec<f64>
Read the full contents of the buffer referenced by
handle.Source§fn dispatch(&self, kernel: &dyn ComputeKernel, work_size: usize)
fn dispatch(&self, kernel: &dyn ComputeKernel, work_size: usize)
Dispatch a compute kernel over
work_size work items.Auto Trait Implementations§
impl !Freeze for CpuBackend
impl !RefUnwindSafe for CpuBackend
impl Send for CpuBackend
impl !Sync for CpuBackend
impl Unpin for CpuBackend
impl UnsafeUnpin for CpuBackend
impl UnwindSafe for CpuBackend
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
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>
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 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>
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