Skip to main content

Device

Trait Device 

Source
pub trait Device<'a>: Sized {
    type Buffer<N: Num>: Buffer<'a, N>;
    type Program<K: Kernel>: Program<'a, K>;
    type LaunchConfig: LaunchConfig;

    // Required methods
    fn buffer<N: Num>(&self, count: usize) -> Result<Self::Buffer<N>>;
    fn launch<K: Kernel>(
        &self,
        program: &Self::Program<K>,
        cfg: &Self::LaunchConfig,
        args: K::Args<'a>,
    ) -> Result<()>;
}
Expand description

A device capable of allocating buffers and launching kernels.

Required Associated Types§

Source

type Buffer<N: Num>: Buffer<'a, N>

This device’s buffer type for elements of dtype N.

Source

type Program<K: Kernel>: Program<'a, K>

This device’s compiled-program type for kernel K.

Source

type LaunchConfig: LaunchConfig

This device’s launch configuration type.

Required Methods§

Source

fn buffer<N: Num>(&self, count: usize) -> Result<Self::Buffer<N>>

Allocates a buffer for count elements of N.

Source

fn launch<K: Kernel>( &self, program: &Self::Program<K>, cfg: &Self::LaunchConfig, args: K::Args<'a>, ) -> Result<()>

Launches program with the given launch cfg and args.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§