#[repr(C)]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 Device
s from a list of DeviceIdCore
s
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
.
Methods from Deref<Target = DeviceIdCore>§
sourcepub fn version(&self) -> Result<OpenclVersion, Error>
pub fn version(&self) -> Result<OpenclVersion, Error>
Returns the queried and parsed OpenCL version for this device.