preferred_compute_devices

Function preferred_compute_devices 

Source
pub fn preferred_compute_devices(
    _space: LogicalMemorySpace,
    _op_kind: OpKind,
) -> Result<Vec<ComputeDevice>>
Expand description

Return the preferred compute devices for a given operation on a memory space.

The returned list is ordered by preference (most preferred first).

§Errors

Returns Error::NoCompatibleComputeDevice if no compute device can execute the given operation on the specified memory space.

§Examples

use tenferro_device::{
    preferred_compute_devices, ComputeDevice, LogicalMemorySpace, OpKind,
};

let devices = preferred_compute_devices(
    LogicalMemorySpace::MainMemory,
    OpKind::BatchedGemm,
).unwrap();

// Typically includes CPU for main memory workloads.
assert!(devices.contains(&ComputeDevice::Cpu { device_id: 0 }));