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
impl Platform
pub fn new(id: cl_platform_id) -> Self
Sourcepub const fn id(&self) -> cl_platform_id
pub const fn id(&self) -> cl_platform_id
Accessor for the underlying platform id.
Sourcepub fn get_devices(
&self,
device_type: cl_device_type,
) -> Result<Vec<cl_device_id>>
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());
pub unsafe fn get_device_ids_from_dx9_intel( &self, dx9_device_source: cl_dx9_device_source_intel, dx9_object: *mut c_void, dx9_device_set: cl_dx9_device_set_intel, ) -> Result<Vec<cl_device_id>>
Sourcepub fn profile(&self) -> Result<String>
pub fn profile(&self) -> Result<String>
The OpenCL profile supported by the Platform, it can be FULL_PROFILE or EMBEDDED_PROFILE.
Sourcepub fn version(&self) -> Result<String>
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.
Sourcepub fn extensions(&self) -> Result<String>
pub fn extensions(&self) -> Result<String>
A space separated list of extension names supported by the Platform.
Sourcepub fn host_timer_resolution(&self) -> Result<cl_ulong>
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
Sourcepub fn numeric_version(&self) -> Result<cl_version>
pub fn numeric_version(&self) -> Result<cl_version>
The detailed (major, minor, patch) version supported by the platform.
CL_VERSION_3_0
Sourcepub fn extensions_with_version(&self) -> Result<Vec<cl_name_version>>
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
Sourcepub fn platform_external_memory_import_handle_types_khr(
&self,
) -> Result<Vec<cl_name_version>>
pub fn platform_external_memory_import_handle_types_khr( &self, ) -> Result<Vec<cl_name_version>>
cl_khr_external_memory
Sourcepub fn platform_semaphore_import_handle_types_khr(
&self,
) -> Result<Vec<cl_name_version>>
pub fn platform_semaphore_import_handle_types_khr( &self, ) -> Result<Vec<cl_name_version>>
cl_khr_external_semaphore
Sourcepub fn platform_semaphore_export_handle_types_khr(
&self,
) -> Result<Vec<cl_name_version>>
pub fn platform_semaphore_export_handle_types_khr( &self, ) -> Result<Vec<cl_name_version>>
cl_khr_external_semaphore
Sourcepub fn platform_semaphore_types_khr(&self) -> Result<Vec<cl_name_version>>
pub fn platform_semaphore_types_khr(&self) -> Result<Vec<cl_name_version>>
cl_khr_semaphore
Sourcepub fn get_data(&self, param_name: cl_platform_info) -> Result<Vec<u8>>
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.
Sourcepub unsafe fn unload_compiler(&self) -> Result<()>
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.