Skip to main content

DispatchDevice

Enum DispatchDevice 

Source
pub enum DispatchDevice {
    Flex(FlexDevice),
}
Expand description

Represents a device for the Dispatch.

Each variant corresponds to a backend that the Dispatch can dispatch operations to.

§Example

ⓘ
use burn::DispatchDevice;

// One variant covers every cubecl runtime; the device inside says which.
#[cfg(feature = "cuda")]
let cuda_device = DispatchDevice::Cube(cubecl::Device::Cuda(Default::default()));

#[cfg(feature = "ndarray")]
let ndarray_device = DispatchDevice::NdArray(Default::default());

Variants§

§

Flex(FlexDevice)

Available on crate feature flex only.

The Flex backend device (CPU-only).

Implementations§

Source§

impl DispatchDevice

Source

pub fn inner(self) -> Self

Returns the inner device, without autodiff (when enabled).

Trait Implementations§

Source§

impl Clone for DispatchDevice

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DispatchDevice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DispatchDevice

Source§

fn default() -> Self

Select an enabled backend in this order: CUDA, Metal, ROCm, Vulkan, WebGPU, wgpu, CPU, LibTorch, Flex, Remote, NdArray. BURN_DEVICE overrides this in std builds. Capture devices must be constructed explicitly.

The metal, vulkan, and webgpu overrides require their matching Cargo features and pin the graphics API. Explicit Metal selection requires native MSL support. The wgpu override keeps automatic API and compiler selection with WGSL fallback.

Panics when no execution backend is enabled, or when BURN_DEVICE names an unknown backend or one whose Cargo feature is not enabled.

Source§

impl Device for DispatchDevice

Source§

fn from_id(device_id: DeviceId) -> Self

Create a device from its id.
Source§

fn to_id(&self) -> DeviceId

Retrieve the device id from the device.
Source§

impl DeviceOps for DispatchDevice

Source§

fn defaults(&self) -> DeviceSettings

Returns the default settings for this device.
Source§

fn id(&self) -> DeviceId

Returns the device id.
Source§

impl Eq for DispatchDevice

Source§

impl From<FlexDevice> for DispatchDevice

Available on crate feature flex only.
Source§

fn from(device: FlexDevice) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for DispatchDevice

Source§

fn eq(&self, other: &Self) -> bool

Compares devices based on hardware identity.

Returns true if both devices represent the same compute resource. Note that this comparison ignores autodiff and checkpointing settings.

1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.