MCPcopy Create free account
hub / github.com/boostorg/compute / partition

Method partition

include/boost/compute/device.hpp:329–353  ·  view source on GitHub ↗

Partitions the device into multiple sub-devices according to \p properties. \opencl_version_warning{1,2}

Source from the content-addressed store, hash-verified

327 ///
328 /// \opencl_version_warning{1,2}
329 std::vector<device>
330 partition(const cl_device_partition_property *properties) const
331 {
332 // get sub-device count
333 uint_ count = 0;
334 int_ ret = clCreateSubDevices(m_id, properties, 0, 0, &count);
335 if(ret != CL_SUCCESS){
336 BOOST_THROW_EXCEPTION(opencl_error(ret));
337 }
338
339 // get sub-device ids
340 std::vector<cl_device_id> ids(count);
341 ret = clCreateSubDevices(m_id, properties, count, &ids[0], 0);
342 if(ret != CL_SUCCESS){
343 BOOST_THROW_EXCEPTION(opencl_error(ret));
344 }
345
346 // convert ids to device objects
347 std::vector<device> devices(count);
348 for(size_t i = 0; i < count; i++){
349 devices[i] = device(ids[i], false);
350 }
351
352 return devices;
353 }
354
355 /// \opencl_version_warning{1,2}
356 std::vector<device> partition_equally(size_t count) const

Callers

nothing calls this directly

Calls 2

opencl_errorClass · 0.85
deviceClass · 0.85

Tested by

no test coverage detected