Skip to main content

InProcessDevice

Trait InProcessDevice 

Source
pub trait InProcessDevice<T> {
    type Context: Clone + Send + Sync + 'static;
    type Buffer: Clone + Send + Sync + 'static;
    type Kernel: Clone + Send + Sync + 'static;
    type ReductionLaunch;
    type Error: Error + Send + Sync + 'static;

    const ELEMENT_SIZE: usize;

    // Required methods
    fn buffer_len(buffer: &Self::Buffer) -> usize;
    fn buffer_is_empty(buffer: &Self::Buffer) -> bool;
    fn alloc(
        context: &Self::Context,
        length: usize,
    ) -> Result<Self::Buffer, Self::Error>;
    fn copy_to_device(
        context: &Self::Context,
        buffer: &Self::Buffer,
        values: &[T],
    ) -> Result<(), Self::Error>;
    fn copy_to_device_at(
        context: &Self::Context,
        buffer: &Self::Buffer,
        offset: usize,
        values: &[T],
    ) -> Result<(), Self::Error>;
    fn copy_from_device(
        context: &Self::Context,
        buffer: &Self::Buffer,
    ) -> Result<Vec<T>, Self::Error>;
    fn copy_from_device_at(
        context: &Self::Context,
        buffer: &Self::Buffer,
        offset: usize,
        length: usize,
    ) -> Result<Vec<T>, Self::Error>;
    fn prepare_reduction(
        length: u32,
        destination_offset: u32,
    ) -> Self::ReductionLaunch;
    fn launch_reduction(
        context: &Self::Context,
        kernel: &Self::Kernel,
        launch: &Self::ReductionLaunch,
        source: &Self::Buffer,
        destination: &Self::Buffer,
    ) -> Result<(), Self::Error>;
}

Required Associated Constants§

Required Associated Types§

Source

type Context: Clone + Send + Sync + 'static

Source

type Buffer: Clone + Send + Sync + 'static

Source

type Kernel: Clone + Send + Sync + 'static

Source

type ReductionLaunch

Source

type Error: Error + Send + Sync + 'static

Required Methods§

Source

fn buffer_len(buffer: &Self::Buffer) -> usize

Source

fn buffer_is_empty(buffer: &Self::Buffer) -> bool

Source

fn alloc( context: &Self::Context, length: usize, ) -> Result<Self::Buffer, Self::Error>

Source

fn copy_to_device( context: &Self::Context, buffer: &Self::Buffer, values: &[T], ) -> Result<(), Self::Error>

Source

fn copy_to_device_at( context: &Self::Context, buffer: &Self::Buffer, offset: usize, values: &[T], ) -> Result<(), Self::Error>

Source

fn copy_from_device( context: &Self::Context, buffer: &Self::Buffer, ) -> Result<Vec<T>, Self::Error>

Source

fn copy_from_device_at( context: &Self::Context, buffer: &Self::Buffer, offset: usize, length: usize, ) -> Result<Vec<T>, Self::Error>

Source

fn prepare_reduction( length: u32, destination_offset: u32, ) -> Self::ReductionLaunch

Source

fn launch_reduction( context: &Self::Context, kernel: &Self::Kernel, launch: &Self::ReductionLaunch, source: &Self::Buffer, destination: &Self::Buffer, ) -> Result<(), Self::Error>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§