Skip to main content

GpuOperations

Trait GpuOperations 

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

Source

fn allocate<T>(&self, size: usize) -> Result<GpuBuffer<T>, SimdError>

Allocate GPU memory

Source

fn copy_to_device<T>( &self, host_data: &[T], gpu_buffer: &mut GpuBuffer<T>, ) -> Result<(), SimdError>

Copy data from host to device

Source

fn copy_to_host<T>( &self, gpu_buffer: &GpuBuffer<T>, host_data: &mut [T], ) -> Result<(), SimdError>

Copy data from device to host

Source

fn launch_kernel( &self, kernel: &str, config: &KernelConfig, args: &[&dyn Any], ) -> Result<(), SimdError>

Launch kernel with configuration

Source

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".

Implementors§