title: How to declare local memory in OpenCL?
body: <p>I'm running the OpenCL kernel below with a two-dimensional global work size of 1000000 x 100 and a local work size of 1 x 100.</p>
  
  <pre><code>__kernel void myKernel(
          const int length, 
          const int height, 
          and a bunch of other parameters) {
  
      //declare some local arrays to be shared by all 100 work item in this group
      __local float LP [length];
      __local float LT [height];
      __local int bitErrors = 0;
      __local bool failed = false;
  
      //here come my actual computations which utilize the space in LP and LT
  }
  </code></pre>
  
  <p>This however refuses to compile, since the parameters <code>length</code> and <code>height</code> are not known at compile time. But it is not clear to my at all how to do this correctly. Should I use pointers with memalloc? How to handle this in a way that the memory is only allocated once for the entire workgroup and not once per work item?</p>
  
  <p>All that I need is 2 arrays of floats, 1 int and 1 boolean that are shared among the entire workgroup (so all 100 work items). But I fail to find any method that does this correctly...</p>