title: What causes and how can I check the number of work-groups limit in OpenCL?
body: <p>I've shortly started using OpenCL to write programs for GPUs. I'm familiar with basic concepts that are required to write efficient programs in OpenCL, like work-items, work-groups, global-item-size, barriers, etc.</p>
  <p>One of my programs involved making about 20 million work-groups with 360 work-items in each work-group. However, for some reason OpenCL couldn't handle that many number of work-groups. All elements of my output array simply remained 0. In addition, OpenCL didn't even start the calculations when I called clEnqueueNDRangeKernel(), since when I viewed the GPU usage stats I didn't see a &quot;spike&quot; that usually happens when I run an OpenCL kernel. I attempted to reduce the number work-groups, to see what is the maximum number of work-groups. It was 5965232 and it  is <em>always</em> 5965232. Not more, not less.</p>
  <p>I know that the problem is NOT with the number of work-items. It is with the number of work-groups. To prove this, here is my original code, where LIST_SIZE is 360.</p>
  <pre><code>global_item_size = 5965232*LIST_SIZE;
  local_size = LIST_SIZE;
  </code></pre>
  <p>and a modified version of my code:</p>
  <pre><code>global_item_size = 5965232*LIST_SIZE*1.3;
  local_size = LIST_SIZE*1.3;
  </code></pre>
  <p>In all the scenarios, the number of work-groups limit was 5965232.</p>
  <p>I'm trying to find out what causes this limit and how to check this limit. I understand that there may be a limitation, but <strong>what causes this limitation</strong> and <strong>how can I check check this limit number</strong> in OpenCL? I've did a lot of research, but all sites are talking about <em>work-group size limits</em> and not about <em>number of work-group limits</em>.</p>
  <p>I'm using the Intel Graphics HD 4000 GPU with an i5-3320M. It has 32 MB of integrated RAM.</p>