Struct burn_compute::ComputeRuntime

source ·
pub struct ComputeRuntime<Device, Server: ComputeServer, Channel> { /* private fields */ }
Expand description

The compute type has the responsibility to retrieve the correct compute client based on the given device.

Implementations§

source§

impl<Device, Server, Channel> ComputeRuntime<Device, Server, Channel>
where Device: Hash + PartialEq + Eq + Clone + Debug, Server: ComputeServer, Channel: ComputeChannel<Server>,

source

pub const fn new() -> Self

Create a new compute.

source

pub fn client<Init>( &self, device: &Device, init: Init ) -> ComputeClient<Server, Channel>
where Init: Fn() -> ComputeClient<Server, Channel>,

Get the compute client for the given device.

Provide the init function to create a new client if it isn’t already initialized.

source

pub fn register(&self, device: &Device, client: ComputeClient<Server, Channel>)

Register the compute client for the given device.

§Note

This function is mostly useful when the creation of the compute client can’t be done synchronously and require special context.

§Panics

If a client is already registered for the given device.

Auto Trait Implementations§

§

impl<Device, Server, Channel> !Freeze for ComputeRuntime<Device, Server, Channel>

§

impl<Device, Server, Channel> !RefUnwindSafe for ComputeRuntime<Device, Server, Channel>

§

impl<Device, Server, Channel> Send for ComputeRuntime<Device, Server, Channel>
where Device: Send, Channel: Send + Sync,

§

impl<Device, Server, Channel> Sync for ComputeRuntime<Device, Server, Channel>
where Device: Send, Channel: Send + Sync,

§

impl<Device, Server, Channel> Unpin for ComputeRuntime<Device, Server, Channel>
where Device: Unpin, Channel: Unpin,

§

impl<Device, Server, Channel> UnwindSafe for ComputeRuntime<Device, Server, Channel>
where Device: UnwindSafe, Channel: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V