Skip to main content

Platform

Struct 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: *mut c_void) -> Platform

Source

pub const fn id(&self) -> *mut c_void

Accessor for the underlying platform id.

Source

pub fn get_devices(&self, device_type: u64) -> Result<Vec<*mut c_void>, ClError>

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 unsafe fn get_device_ids_from_dx9_intel( &self, dx9_device_source: u32, dx9_object: *mut c_void, dx9_device_set: u32, ) -> Result<Vec<*mut c_void>, ClError>

Source

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

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

Source

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

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, ClError>

The OpenCL Platform name string.

Source

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

The OpenCL Platform vendor string.

Source

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

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

Source

pub fn host_timer_resolution(&self) -> Result<u64, ClError>

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

Source

pub fn numeric_version(&self) -> Result<u32, ClError>

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>, ClError>

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>, ClError>

cl_khr_external_memory

Source

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

cl_khr_external_semaphore

Source

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

cl_khr_external_semaphore

Source

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

cl_khr_semaphore

Source

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

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

Source

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

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 duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Platform

Source§

impl Debug for Platform

Source§

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

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

impl From<*mut c_void> for Platform

Source§

fn from(value: *mut c_void) -> Platform

Converts to this type from the input type.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.