pub trait GpuOperations {
// Required methods
fn allocate<T>(&self, size: usize) -> Result<GpuBuffer<T>, SimdError>;
fn copy_to_device<T>(
&self,
host_data: &[T],
gpu_buffer: &mut GpuBuffer<T>,
) -> Result<(), SimdError>;
fn copy_to_host<T>(
&self,
gpu_buffer: &GpuBuffer<T>,
host_data: &mut [T],
) -> Result<(), SimdError>;
fn launch_kernel(
&self,
kernel: &str,
config: &KernelConfig,
args: &[&dyn Any],
) -> Result<(), SimdError>;
fn synchronize(&self) -> Result<(), SimdError>;
}Expand description
GPU operations interface
Required Methods§
Sourcefn copy_to_device<T>(
&self,
host_data: &[T],
gpu_buffer: &mut GpuBuffer<T>,
) -> Result<(), SimdError>
fn copy_to_device<T>( &self, host_data: &[T], gpu_buffer: &mut GpuBuffer<T>, ) -> Result<(), SimdError>
Copy data from host to device
Sourcefn copy_to_host<T>(
&self,
gpu_buffer: &GpuBuffer<T>,
host_data: &mut [T],
) -> Result<(), SimdError>
fn copy_to_host<T>( &self, gpu_buffer: &GpuBuffer<T>, host_data: &mut [T], ) -> Result<(), SimdError>
Copy data from device to host
Sourcefn launch_kernel(
&self,
kernel: &str,
config: &KernelConfig,
args: &[&dyn Any],
) -> Result<(), SimdError>
fn launch_kernel( &self, kernel: &str, config: &KernelConfig, args: &[&dyn Any], ) -> Result<(), SimdError>
Launch kernel with configuration
Sourcefn synchronize(&self) -> Result<(), SimdError>
fn synchronize(&self) -> Result<(), SimdError>
Synchronize device
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".