[−][src]Function emu_core::pool::select
pub fn select<F: FnMut(usize, Option<DeviceInfo>) -> bool>(
selector: F
) -> Result<(), NoDeviceError>
Selects a device from the pool using the given selector function
Emu uses thread-local storage to keep track of the selected device for each thread.
select
lets you select a device for the thread it is called from.
futures::executor::block_on(assert_device_pool_initialized()); select(|idx, info| if let Some(info) = info { info.name().to_ascii_lowercase().contains("intel") } else { false })?; let mut d = take()?.lock()?; let pi: DeviceBox<f32> = d.create_with_size(std::mem::size_of::<f32>());