Struct ocl::Device

source ·
#[repr(C)]
pub struct Device(/* private fields */);
Expand description

An individual device identifier (an OpenCL device_id).

Implementations§

source§

impl Device

source

pub fn first<P: Borrow<Platform>>(platform: P) -> OclResult<Device>

Returns the first available device on a platform.

source

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.

source

pub fn specifier() -> DeviceSpecifier

Returns a DeviceSpecifier useful for precisely specifying a set of devices.

source

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.

source

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.

source

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.

source

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.

source

pub fn list_select<P: Borrow<Platform>>( platform: P, device_types: Option<DeviceType>, idxs: &[usize] ) -> OclResult<Vec<Device>>

Returns a list of devices filtered by type then selected using a list of indices.

§Errors

All indices in idxs must be valid.

See ::list for other error information.

source

pub fn list_select_wrap<P: Borrow<Platform>>( platform: P, device_types: Option<DeviceType>, idxs: &[usize] ) -> OclResult<Vec<Device>>

Returns a list of devices filtered by type then selected using a wrapping list of indices.

Wraps indices around (%) so that every index is valid.

§Errors

See ::list

source

pub fn list_from_core(devices: Vec<DeviceIdCore>) -> Vec<Device>

Returns a list of Devices from a list of DeviceIdCores

source

pub fn name(&self) -> OclResult<String>

Returns the device name.

source

pub fn vendor(&self) -> OclResult<String>

Returns the device vendor as a string.

source

pub fn max_wg_size(&self) -> OclResult<usize>

Returns the maximum workgroup size or an error.

source

pub fn mem_base_addr_align(&self) -> OclResult<u32>

Returns the memory base address alignment offset or an error.

source

pub fn is_available(&self) -> OclResult<bool>

Returns whether or not the device is available for use.

source

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.

source

pub fn info(&self, info_kind: DeviceInfo) -> OclResult<DeviceInfoResult>

Returns info about the device.

source

pub fn to_string(&self) -> String

Returns a string containing a formatted list of device properties.

source

pub fn as_core(&self) -> &DeviceIdCore

Returns the underlying DeviceIdCore.

Methods from Deref<Target = DeviceIdCore>§

source

pub fn as_raw(&self) -> *mut c_void

Returns a pointer.

source

pub fn version(&self) -> Result<OpenclVersion, Error>

Returns the queried and parsed OpenCL version for this device.

Trait Implementations§

source§

impl AsRef<Device> for Device

source§

fn as_ref(&self) -> &Device

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<'a> ClDeviceIdPtr for &'a Device

source§

impl ClDeviceIdPtr for Device

source§

impl Clone for Device

source§

fn clone(&self) -> Device

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Device

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for Device

§

type Target = DeviceId

The resulting type after dereferencing.
source§

fn deref(&self) -> &DeviceIdCore

Dereferences the value.
source§

impl DerefMut for Device

source§

fn deref_mut(&mut self) -> &mut DeviceIdCore

Mutably dereferences the value.
source§

impl Display for Device

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'a> From<&'a Device> for DeviceSpecifier

source§

fn from(device: &'a Device) -> DeviceSpecifier

Converts to this type from the input type.
source§

impl From<Device> for DeviceId

source§

fn from(d: Device) -> DeviceIdCore

Converts to this type from the input type.
source§

impl From<Device> for DeviceSpecifier

source§

fn from(device: Device) -> DeviceSpecifier

Converts to this type from the input type.
source§

impl From<Device> for String

source§

fn from(d: Device) -> String

Converts to this type from the input type.
source§

impl From<DeviceId> for Device

source§

fn from(core: DeviceIdCore) -> Device

Converts to this type from the input type.
source§

impl Hash for Device

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for Device

source§

fn eq(&self, other: &Device) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Device

source§

impl Eq for Device

source§

impl StructuralPartialEq for Device

Auto Trait Implementations§

§

impl Freeze for Device

§

impl RefUnwindSafe for Device

§

impl Send for Device

§

impl Sync for Device

§

impl Unpin for Device

§

impl UnwindSafe for Device

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.