pub enum WgpuDevice {
DiscreteGpu(usize),
IntegratedGpu(usize),
VirtualGpu(usize),
Cpu,
DefaultDevice,
BestAvailable,
Existing(u32),
}
Expand description
The device struct when using the wgpu
backend.
Note that you need to provide the device index when using a GPU backend.
§Example
use cubecl_wgpu::WgpuDevice;
let device_gpu_1 = WgpuDevice::DiscreteGpu(0); // First discrete GPU found.
let device_gpu_2 = WgpuDevice::DiscreteGpu(1); // Second discrete GPU found.
Variants§
DiscreteGpu(usize)
Discrete GPU with the given index. The index is the index of the discrete GPU in the list of all discrete GPUs found on the system.
IntegratedGpu(usize)
Integrated GPU with the given index. The index is the index of the integrated GPU in the list of all integrated GPUs found on the system.
VirtualGpu(usize)
Virtual GPU with the given index. The index is the index of the virtual GPU in the list of all virtual GPUs found on the system.
Cpu
CPU.
DefaultDevice
The best available device found with the current graphics API.
This will prioritize GPUs wgpu recognizes as “high power”. Additionally, you can override this using
the CUBECL_WGPU_DEFAULT_DEVICE
environment variable. This variable is spelled as if i was a WgpuDevice,
so for example CUBECL_WGPU_DEFAULT_DEVICE=IntegratedGpu(1) or CUBECL_WGPU_DEFAULT_DEVICE=Cpu
BestAvailable
Deprecated, use DefaultDevice
.
Existing(u32)
Use an externally created, existing, wgpu setup. This is helpful when using CubeCL in conjunction with some existing wgpu setup (eg. egui or bevy), as resources can be transferred in & out of CubeCL.
§Notes
This can be initialized with init_device
.
Trait Implementations§
Source§impl Clone for WgpuDevice
impl Clone for WgpuDevice
Source§fn clone(&self) -> WgpuDevice
fn clone(&self) -> WgpuDevice
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for WgpuDevice
impl Debug for WgpuDevice
Source§impl Default for WgpuDevice
impl Default for WgpuDevice
Source§impl Hash for WgpuDevice
impl Hash for WgpuDevice
Source§impl PartialEq for WgpuDevice
impl PartialEq for WgpuDevice
impl Eq for WgpuDevice
impl StructuralPartialEq for WgpuDevice
Auto Trait Implementations§
impl Freeze for WgpuDevice
impl RefUnwindSafe for WgpuDevice
impl Send for WgpuDevice
impl Sync for WgpuDevice
impl Unpin for WgpuDevice
impl UnwindSafe for WgpuDevice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.