pub struct Device(/* private fields */);Expand description
An individual device identifier (an OpenCL device_id).
Implementations§
Source§impl Device
impl Device
Sourcepub fn first<P: Borrow<Platform>>(platform: P) -> OclResult<Device>
pub fn first<P: Borrow<Platform>>(platform: P) -> OclResult<Device>
Returns the first available device on a platform.
Sourcepub fn by_idx_wrap<P: Borrow<Platform>>(
platform: P,
device_idx_wrap: usize,
) -> OclResult<Device>
pub fn by_idx_wrap<P: Borrow<Platform>>( platform: P, device_idx_wrap: usize, ) -> OclResult<Device>
Returns a single device specified by a wrapped index.
Sourcepub fn specifier() -> DeviceSpecifier
pub fn specifier() -> DeviceSpecifier
Returns a DeviceSpecifier useful for precisely specifying a set
of devices.
Sourcepub fn resolve_idxs(
idxs: &[usize],
devices: &[Device],
) -> OclResult<Vec<Device>>
pub fn resolve_idxs( idxs: &[usize], devices: &[Device], ) -> OclResult<Vec<Device>>
Resolves a list of indices into a list of valid devices.
devices is the set of all indexable devices.
§Errors
All indices in idxs must be valid. Use resolve_idxs_wrap for index
lists which may contain out of bounds indices.
Sourcepub fn resolve_idxs_wrap(idxs: &[usize], devices: &[Device]) -> Vec<Device>
pub fn resolve_idxs_wrap(idxs: &[usize], devices: &[Device]) -> Vec<Device>
Resolves a list of indices into a list of valid devices.
devices is the set of all indexable devices.
Wraps indices around using modulo (%) so that every index is valid.
Sourcepub fn list<P: Borrow<Platform>>(
platform: P,
device_types: Option<DeviceType>,
) -> OclResult<Vec<Device>>
pub fn list<P: Borrow<Platform>>( platform: P, device_types: Option<DeviceType>, ) -> OclResult<Vec<Device>>
Returns a list of all devices avaliable for a given platform which
optionally match the flags set in the bitfield, device_types.
Setting device_types to None will return a list of all avaliable
devices for platform regardless of type.
§Errors
Returns an Err(ocl::core::Error::Status {...}) enum variant upon any
OpenCL error. Calling .status() on the returned error will return
an Option(``[ocl::core::Status]``) which can be unwrapped then
matched to determine the precise reason for failure.
Sourcepub fn list_all<P: Borrow<Platform>>(platform: P) -> OclResult<Vec<Device>>
pub fn list_all<P: Borrow<Platform>>(platform: P) -> OclResult<Vec<Device>>
Returns a list of all devices avaliable for a given platform.
Equivalent to ::list(platform, None).
See ::list for other
error information.
Sourcepub fn list_select<P: Borrow<Platform>>(
platform: P,
device_types: Option<DeviceType>,
idxs: &[usize],
) -> OclResult<Vec<Device>>
pub fn list_select<P: Borrow<Platform>>( platform: P, device_types: Option<DeviceType>, idxs: &[usize], ) -> OclResult<Vec<Device>>
Sourcepub fn list_select_wrap<P: Borrow<Platform>>(
platform: P,
device_types: Option<DeviceType>,
idxs: &[usize],
) -> OclResult<Vec<Device>>
pub fn list_select_wrap<P: Borrow<Platform>>( platform: P, device_types: Option<DeviceType>, idxs: &[usize], ) -> OclResult<Vec<Device>>
Sourcepub fn list_from_core(devices: Vec<DeviceIdCore>) -> Vec<Device>
pub fn list_from_core(devices: Vec<DeviceIdCore>) -> Vec<Device>
Returns a list of Devices from a list of DeviceIdCores
Sourcepub fn max_wg_size(&self) -> OclResult<usize>
pub fn max_wg_size(&self) -> OclResult<usize>
Returns the maximum workgroup size or an error.
Sourcepub fn mem_base_addr_align(&self) -> OclResult<u32>
pub fn mem_base_addr_align(&self) -> OclResult<u32>
Returns the memory base address alignment offset or an error.
Sourcepub fn is_available(&self) -> OclResult<bool>
pub fn is_available(&self) -> OclResult<bool>
Returns whether or not the device is available for use.
Sourcepub fn info_raw(&self, info_kind: u32) -> OclResult<Vec<u8>>
pub fn info_raw(&self, info_kind: u32) -> OclResult<Vec<u8>>
Returns raw info about the device, as a vector of bytes. Intended for use with non-standard OpenCL extensions.
Sourcepub fn info(&self, info_kind: DeviceInfo) -> OclResult<DeviceInfoResult>
pub fn info(&self, info_kind: DeviceInfo) -> OclResult<DeviceInfoResult>
Returns info about the device.
Sourcepub fn to_string(&self) -> String
pub fn to_string(&self) -> String
Returns a string containing a formatted list of device properties.
Sourcepub fn as_core(&self) -> &DeviceIdCore
pub fn as_core(&self) -> &DeviceIdCore
Returns the underlying DeviceIdCore.