@@ -253,6 +253,35 @@ class command_queue
253253 return get_info<cl_command_queue_properties>(CL_QUEUE_PROPERTIES);
254254 }
255255
256+ #if defined(BOOST_COMPUTE_CL_VERSION_2_1) || defined(BOOST_COMPUTE_DOXYGEN_INVOKED)
257+ // / Returns the current default device command queue for the underlying device.
258+ // /
259+ // / \opencl_version_warning{2,1}
260+ command_queue get_default_device_queue () const
261+ {
262+ return command_queue (get_info<cl_command_queue>(CL_QUEUE_DEVICE_DEFAULT));
263+ }
264+
265+ // / Replaces the default device command queue for the underlying device
266+ // / with this command queue. Command queue must have been created
267+ // / with CL_QUEUE_ON_DEVICE flag.
268+ // /
269+ // / \see_opencl21_ref{clSetDefaultDeviceCommandQueue}
270+ // /
271+ // / \opencl_version_warning{2,1}
272+ void set_as_default_device_queue () const
273+ {
274+ cl_int ret = clSetDefaultDeviceCommandQueue (
275+ this ->get_context ().get (),
276+ this ->get_device ().get (),
277+ m_queue
278+ );
279+ if (ret != CL_SUCCESS){
280+ BOOST_THROW_EXCEPTION (opencl_error (ret));
281+ }
282+ }
283+ #endif // BOOST_COMPUTE_CL_VERSION_2_1
284+
256285 // / Enqueues a command to read data from \p buffer to host memory.
257286 // /
258287 // / \see_opencl_ref{clEnqueueReadBuffer}
@@ -1886,6 +1915,12 @@ BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS(command_queue,
18861915 ((cl_command_queue_properties, CL_QUEUE_PROPERTIES))
18871916)
18881917
1918+ #ifdef BOOST_COMPUTE_CL_VERSION_2_1
1919+ BOOST_COMPUTE_DETAIL_DEFINE_GET_INFO_SPECIALIZATIONS (command_queue,
1920+ ((cl_command_queue, CL_QUEUE_DEVICE_DEFAULT))
1921+ )
1922+ #endif // BOOST_COMPUTE_CL_VERSION_2_1
1923+
18891924} // end compute namespace
18901925} // end boost namespace
18911926
0 commit comments