title: How to get the maximum global work size with OpenCL C++ bindings?
body: <p>I want to get the maximum global work size. 
  I don't want  a kernel OpenCL will try to choose the best one for you, which MAY or MAY NOT be the maximum size.</p>
  
  <p>To do this I want to specify the size when call <code>clEnqueueNDRangeKernel</code>.
  e.g:</p>
  
  <pre><code>clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &amp;global_size, NULL, 0, NULL, NULL);
  </code></pre>
  
  <p><a href="https://www.khronos.org/registry/OpenCL/sdk/1.2/docs/man/xhtml/clGetKernelWorkGroupInfo.html" rel="nofollow noreferrer">clGetKernelWorkGroupInfo documentation</a>, indicates :</p>
  
  <p><em>CL_KERNEL_GLOBAL_WORK_SIZE : This provides a mechanism for the application to query the maximum global size that can be used to execute a kernel (i.e. global_work_size argument to clEnqueueNDRangeKernel) on a custom device given by device or a built-in kernel on an OpenCL device given by device.</em></p>
  
  <p>How can I get <code>CL_KERNEL_GLOBAL_WORK_SIZE</code> with OpenCL C++ bindings ?</p>
  
  <p>I do this </p>
  
  <pre><code>cl::array&lt;size_t, 3&gt; kernel_global_work_size = my_kernel.getWorkGroupInfo&lt;CL_KERNEL_GLOBAL_WORK_SIZE&gt;(my_device);
  </code></pre>
  
  <p>But I got error :</p>
  
  <pre><code>cl2.hpp:5771:12: note: candidate: template&lt;class T&gt; cl_int cl::Kernel::getWorkGroupInfo(const cl::Device&amp;, cl_kernel_work_group_info, T*) const
       cl_int getWorkGroupInfo(
              ^~~~~~~~~~~~~~~~
  cl2.hpp:5771:12: note:   template argument deduction/substitution failed:
  cl2.hpp:5782:9: note: candidate: template&lt;int name&gt; typename cl::detail::param_traits&lt;cl::detail::cl_kernel_work_group_info, name&gt;::param_type cl::Kernel::getWorkGroupInfo(const cl::Device&amp;, cl_int*) const
           getWorkGroupInfo(const Device&amp; device, cl_int* err = NULL) const
  </code></pre>
  
  <p>And with this code </p>
  
  <pre><code>cl::array&lt;size_t, 3&gt; kernel_global_work_size;
  my_kernel.getWorkGroupInfo&lt;cl::array&lt;size_t, 3&gt;&gt;(my_device, CL_KERNEL_GLOBAL_WORK_SIZE, &amp;kernel_global_work_size);
  </code></pre>
  
  <p>I got OpenCL error -30 (Invalid Value)</p>
  
  <p><code>my_kernel</code> is not Built-in Kernel 
  e.g: <code>cl::Kernel my_kernel = cl::Kernel(program, "my_kernel");</code>
  <code>my_device</code> is not Custom device.
  e.g: <code>cl::Device device = myDevices[0];</code></p>