Function opencl3::device::get_device_ids[][src]

pub fn get_device_ids(
    platform: *mut c_void,
    device_type: u64
) -> Result<Vec<*mut c_void, Global>, i32>
Expand description

Get the list of available devices of the given type on a platform.
Calls clGetDeviceIDs to get the available device ids on the platform.

Examples

use cl3::platform::get_platform_ids;
use cl3::device::{get_device_ids, CL_DEVICE_TYPE_GPU};

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());
  • platform - the cl_platform_id of the OpenCL platform.
  • device_type - the type of device, see Device Types.

returns a Result containing a vector of available device ids or the error code from the OpenCL C API function.