Function opencl3::device::get_device_info [−][src]
pub fn get_device_info(
device: *mut c_void,
param_name: DeviceInfo
) -> Result<InfoType, i32>
Get specific information about an OpenCL device.
Calls clGetDeviceInfo to get the desired information about the device.
Examples
use cl3::platform::get_platform_ids; use cl3::device::{get_device_ids, get_device_info, CL_DEVICE_TYPE_GPU, DeviceInfo,}; let platform_ids = get_platform_ids().unwrap(); assert!(0 < platform_ids.len()); // Choose a the first platform let platform_id = platform_ids[0]; let device_ids = get_device_ids(platform_id, CL_DEVICE_TYPE_GPU).unwrap(); println!("CL_DEVICE_TYPE_GPU count: {}", device_ids.len()); assert!(0 < device_ids.len()); // Choose a the first device let device_id = device_ids[0]; let value = get_device_info(device_id, DeviceInfo::CL_DEVICE_TYPE).unwrap(); let value = value.to_ulong(); println!("CL_DEVICE_TYPE: {}", value); assert_eq!(CL_DEVICE_TYPE_GPU, value); let value = get_device_info(device_id, DeviceInfo::CL_DEVICE_VENDOR).unwrap(); let value = value.to_string(); println!("CL_DEVICE_VENDOR: {}", value); assert!(!value.is_empty()); let value = get_device_info(device_id, DeviceInfo::CL_DEVICE_VERSION).unwrap(); let value = value.to_string(); println!("CL_DEVICE_VERSION: {}", value); assert!(!value.is_empty());
device
- the cl_device_id of the OpenCL device.param_name
- the type of device information being queried, see Device Queries.
returns a Result containing the desired information in an InfoType enum or the error code from the OpenCL C API function.