pub struct CpuBackend { /* private fields */ }Expand description
CPU backend (fallback implementation)
Implementations§
Source§impl CpuBackend
impl CpuBackend
pub fn new() -> Result<Self, BackendError>
pub fn is_available() -> bool
Trait Implementations§
Source§impl Backend for CpuBackend
impl Backend for CpuBackend
Source§fn backend_type(&self) -> GpuBackend
fn backend_type(&self) -> GpuBackend
Get backend type
Source§fn initialize(&mut self) -> Result<(), BackendError>
fn initialize(&mut self) -> Result<(), BackendError>
Initialize the backend
Source§fn device_count(&self) -> Result<u32, BackendError>
fn device_count(&self) -> Result<u32, BackendError>
Get device count
Source§fn device_capabilities(
&self,
_device_id: u32,
) -> Result<DeviceCapabilities, BackendError>
fn device_capabilities( &self, _device_id: u32, ) -> Result<DeviceCapabilities, BackendError>
Get device capabilities
Source§fn set_device(&mut self, _device_id: u32) -> Result<(), BackendError>
fn set_device(&mut self, _device_id: u32) -> Result<(), BackendError>
Set active device
Source§fn allocate(&self, size: usize) -> Result<DeviceMemory, BackendError>
fn allocate(&self, size: usize) -> Result<DeviceMemory, BackendError>
Allocate memory on device
Source§fn deallocate(&self, _memory: DeviceMemory) -> Result<(), BackendError>
fn deallocate(&self, _memory: DeviceMemory) -> Result<(), BackendError>
Free device memory
Source§fn copy_to_device(
&self,
_src: &[u8],
_dst: &DeviceMemory,
) -> Result<(), BackendError>
fn copy_to_device( &self, _src: &[u8], _dst: &DeviceMemory, ) -> Result<(), BackendError>
Copy memory from host to device
Source§fn copy_to_host(
&self,
_src: &DeviceMemory,
_dst: &mut [u8],
) -> Result<(), BackendError>
fn copy_to_host( &self, _src: &DeviceMemory, _dst: &mut [u8], ) -> Result<(), BackendError>
Copy memory from device to host
Source§fn synchronize(&self) -> Result<(), BackendError>
fn synchronize(&self) -> Result<(), BackendError>
Synchronize device
Source§fn launch_kernel(
&self,
_kernel: &CompiledKernel,
_args: &[KernelArg],
) -> Result<(), BackendError>
fn launch_kernel( &self, _kernel: &CompiledKernel, _args: &[KernelArg], ) -> Result<(), BackendError>
Launch kernel
Auto Trait Implementations§
impl Freeze for CpuBackend
impl RefUnwindSafe for CpuBackend
impl Send for CpuBackend
impl Sync for CpuBackend
impl Unpin 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