pub trait IFramework {
    type H: IHardware;
    type D: IDevice + Clone;
    type B: IBinary + Clone;

    // Required methods
    fn ID() -> &'static str;
    fn new() -> Self
       where Self: Sized;
    fn load_hardwares() -> Result<Vec<Self::H>, Error>;
    fn hardwares(&self) -> &[Self::H];
    fn binary(&self) -> &Self::B;
    fn new_device(&self, _: &[Self::H]) -> Result<Self::D, Error>;
}
Expand description

Defines a Framework.

Required Associated Types§

source

type H: IHardware

The Hardware representation for this Framework.

source

type D: IDevice + Clone

The Device representation for this Framework.

source

type B: IBinary + Clone

The Binary representation for this Framework.

Required Methods§

source

fn ID() -> &'static str

Defines the Framework by a Name.

For convention, let the ID be uppercase.
EXAMPLE: OPENCL

source

fn new() -> Self
where Self: Sized,

Initializes a new Framework.

Loads all the available hardwares

source

fn load_hardwares() -> Result<Vec<Self::H>, Error>

Initializes all the available hardwares.

source

fn hardwares(&self) -> &[Self::H]

Returns the cached and available hardwares.

source

fn binary(&self) -> &Self::B

Returns the initialized binary.

source

fn new_device(&self, _: &[Self::H]) -> Result<Self::D, Error>

Initializes a new Device from the provided hardwares.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl IFramework for Cuda

§

type H = Device

§

type D = Context

§

type B = Module

source§

impl IFramework for Native

§

type H = Hardware

§

type D = Cpu

§

type B = Binary