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) -> Platform
sourcepub fn id(&self) -> cl_platform_id
pub 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());
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.