Struct ocl::Platform

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

A platform identifier.

Implementations§

source§

impl Platform

source

pub fn list() -> Vec<Platform>

Returns a list of all platforms avaliable on the host machine.

source

pub fn first() -> OclResult<Platform>

Returns the first available platform.

This method differs from Platform::default() in two ways. First, it ignores the OCL_DEFAULT_PLATFORM_IDX environment variable (Platform::default always respects it). Second, this function will not panic if no platforms are available but will instead return an error.

source

pub fn new(id_core: PlatformIdCore) -> Platform

Creates a new Platform from a PlatformIdCore.

§Safety

Not meant to be called unless you know what you’re doing.

Use list to get a list of platforms.

source

pub fn list_from_core(platforms: Vec<PlatformIdCore>) -> Vec<Platform>

Returns a list of Platforms from a list of PlatformIdCores

source

pub fn info(&self, info_kind: PlatformInfo) -> OclResult<PlatformInfoResult>

Returns info about the platform.

source

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

Returns the platform profile as a string.

Returns the profile name supported by the implementation. The profile name returned can be one of the following strings:

  • FULL_PROFILE - if the implementation supports the OpenCL specification (functionality defined as part of the core specification and does not require any extensions to be supported).

  • EMBEDDED_PROFILE - if the implementation supports the OpenCL embedded profile. The embedded profile is defined to be a subset for each version of OpenCL.

source

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

Returns the platform driver version as a string.

Returns the OpenCL version supported by the implementation. This version string has the following format:

  • OpenCL<major_version.minor_version>

  • The major_version.minor_version value returned will be ‘1.2’.

  • TODO: Convert this to new version system returning an OpenclVersion.

source

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

Returns the platform name as a string.

source

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

Returns the platform vendor as a string.

source

pub fn extensions(&self) -> OclResult<Extensions>

Returns the list of platform extensions.

Extensions defined here must be supported by all devices associated with this platform.

source

pub fn as_core(&self) -> &PlatformIdCore

Returns a reference to the underlying PlatformIdCore.

Methods from Deref<Target = PlatformIdCore>§

source

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

Returns a pointer.

source

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

Returns the queried and parsed OpenCL version for this platform.

Trait Implementations§

source§

impl ClPlatformIdPtr for Platform

source§

impl Clone for Platform

source§

fn clone(&self) -> Platform

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 Platform

source§

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

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

impl Default for Platform

source§

fn default() -> Platform

Returns the first (0th) platform available, or the platform specified by the OCL_DEFAULT_PLATFORM_IDX environment variable if it is set.

§Panics

Panics upon any OpenCL API error.

source§

impl Deref for Platform

§

type Target = PlatformId

The resulting type after dereferencing.
source§

fn deref(&self) -> &PlatformIdCore

Dereferences the value.
source§

impl DerefMut for Platform

source§

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

Mutably dereferences the value.
source§

impl Display for Platform

source§

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

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

impl<'a> From<&'a Platform> for PlatformId

source§

fn from(p: &Platform) -> PlatformIdCore

Converts to this type from the input type.
source§

impl From<Platform> for PlatformId

source§

fn from(p: Platform) -> PlatformIdCore

Converts to this type from the input type.
source§

impl From<Platform> for String

source§

fn from(p: Platform) -> String

Converts to this type from the input type.
source§

impl From<PlatformId> for Platform

source§

fn from(core: PlatformIdCore) -> Platform

Converts to this type from the input type.
source§

impl Hash for Platform

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 Copy for Platform

Auto Trait Implementations§

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.