\brief Wrapper for clCreateSubDevices().
| 2499 | #if CL_HPP_TARGET_OPENCL_VERSION >= 120 |
| 2500 | //! \brief Wrapper for clCreateSubDevices(). |
| 2501 | cl_int createSubDevices( |
| 2502 | const cl_device_partition_property * properties, |
| 2503 | vector<Device>* devices) |
| 2504 | { |
| 2505 | cl_uint n = 0; |
| 2506 | cl_int err = clCreateSubDevices(object_, properties, 0, nullptr, &n); |
| 2507 | if (err != CL_SUCCESS) { |
| 2508 | return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); |
| 2509 | } |
| 2510 | |
| 2511 | vector<cl_device_id> ids(n); |
| 2512 | err = clCreateSubDevices(object_, properties, n, ids.data(), nullptr); |
| 2513 | if (err != CL_SUCCESS) { |
| 2514 | return detail::errHandler(err, __CREATE_SUB_DEVICES_ERR); |
| 2515 | } |
| 2516 | |
| 2517 | // Cannot trivially assign because we need to capture intermediates |
| 2518 | // with safe construction |
| 2519 | if (devices) { |
| 2520 | devices->resize(ids.size()); |
| 2521 | |
| 2522 | // Assign to param, constructing with retain behaviour |
| 2523 | // to correctly capture each underlying CL object |
| 2524 | for (size_type i = 0; i < ids.size(); i++) { |
| 2525 | // We do not need to retain because this device is being created |
| 2526 | // by the runtime |
| 2527 | (*devices)[i] = Device(ids[i], false); |
| 2528 | } |
| 2529 | } |
| 2530 | |
| 2531 | return CL_SUCCESS; |
| 2532 | } |
| 2533 | #endif |
| 2534 | |
| 2535 | #if defined(cl_ext_device_fission) |
nothing calls this directly
no test coverage detected