Struct opencl3::platform::Platform

source ·
pub struct Platform { /* private fields */ }
Expand description

An OpenCL platform id and methods to query it.
The query methods calls clGetPlatformInfo with the relevant param_name, see: Platform Queries.

Implementations§

source§

impl Platform

source

pub fn new(id: cl_platform_id) -> Platform

source

pub fn id(&self) -> cl_platform_id

Accessor for the underlying platform id.

source

pub fn get_devices( &self, device_type: cl_device_type ) -> Result<Vec<cl_device_id>>

Get the ids of available devices of the given type on the Platform.

Examples
use opencl3::platform::get_platforms;
use cl3::device::CL_DEVICE_TYPE_GPU;

let platforms = get_platforms().unwrap();
assert!(0 < platforms.len());

// Choose a the first platform
let platform = &platforms[0];
let device_ids = platform.get_devices(CL_DEVICE_TYPE_GPU).unwrap();
println!("CL_DEVICE_TYPE_GPU count: {}", device_ids.len());
assert!(0 < device_ids.len());
source

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

The OpenCL profile supported by the Platform, it can be FULL_PROFILE or EMBEDDED_PROFILE.

source

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

The OpenCL profile version supported by the Platform, e.g. OpenCL 1.2, OpenCL 2.0, OpenCL 2.1, etc.

source

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

The OpenCL Platform name string.

source

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

The OpenCL Platform vendor string.

source

pub fn extensions(&self) -> Result<String>

A space separated list of extension names supported by the Platform.

source

pub fn host_timer_resolution(&self) -> Result<cl_ulong>

The resolution of the host timer in nanoseconds as used by clGetDeviceAndHostTimer.
CL_VERSION_2_1

source

pub fn numeric_version(&self) -> Result<cl_version>

The detailed (major, minor, patch) version supported by the platform.
CL_VERSION_3_0

source

pub fn extensions_with_version(&self) -> Result<Vec<cl_name_version>>

An array of description (name and version) structures that lists all the extensions supported by the platform.
CL_VERSION_3_0

source

pub fn platform_external_memory_import_handle_types_khr( &self ) -> Result<Vec<cl_name_version>>

cl_khr_external_memory

source

pub fn platform_semaphore_import_handle_types_khr( &self ) -> Result<Vec<cl_name_version>>

cl_khr_external_semaphore

source

pub fn platform_semaphore_export_handle_types_khr( &self ) -> Result<Vec<cl_name_version>>

cl_khr_external_semaphore

source

pub fn platform_semaphore_types_khr(&self) -> Result<Vec<cl_name_version>>

cl_khr_semaphore

source

pub fn get_data(&self, param_name: cl_platform_info) -> Result<Vec<u8>>

Get data about an OpenCL platform. Calls clGetPlatformInfo to get the desired data about the platform.

source

pub unsafe fn unload_compiler(&self) -> Result<()>

Unload an OpenCL compiler for a platform. CL_VERSION_1_2

Safety

Compiling is unsafe after the compiler has been unloaded.

Trait Implementations§

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 From<*mut c_void> for Platform

source§

fn from(value: cl_platform_id) -> Self

Converts to this type from the input type.
source§

impl From<Platform> for cl_platform_id

source§

fn from(value: Platform) -> Self

Converts to this type from the input type.
source§

impl Copy for Platform

source§

impl Send for Platform

source§

impl Sync 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> 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, 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.