title: OpenCL Vector components
body: <p>I have a question regarding my kernel code.<br>
  So I understand you cannot access a vector component in a kernel with <code>[]</code> square brackets like example <code>vec[2]</code>.</p>
  
  <p>What are other ways to access it? Say I need to check if the vector element value is more than a certain value?</p>
  
  <p>I am writing a kernel that parses <code>Array1</code> into a local memory vector <code>v</code>,
  checks if any element in <code>v</code> is more than 5 and if so add into another vector call results.</p>
  
  <p>Any advice on accessing the vector components in kernel?</p>
  
  <pre><code>__kernel void copy(__global int4* Array1, 
                 __global int* Array2,
                 __global int8* output
                  ) 
  {
  
      int id = get_global_id(0);
  
      __local int4 v;
  
      v = Array1[id];
  
  
      int8 v1 = vload8(0, Array2);
      int8 v2 = vload8(1, Array2);
  
      int8 results;
  
  
      /* My problem is here where i want to check if the current v[i] is more than 5, 
      if so add v1[i] into results, else add v2[i].*/
  
  
      if (any(v &gt; 5)) {
  
               results.s0 = select(v2.s0, v1.s0, isgreater(v.s0, 5.0));
               results.s1 = select(v2.s1, v1.s1, isgreater(v.s1, 5.0));
               results.s2 = select(v2.s2, v1.s2, isgreater(v.s2, 5.0));
               results.s3 = select(v2.s3, v1.s3, isgreater(v.s3, 5.0));
               results.s4 = select(v2.s4, v1.s4, isgreater(v.s4, 5.0));
               results.s5 = select(v2.s5, v1.s5, isgreater(v.s5, 5.0));
               results.s6 = select(v2.s6, v1.s6, isgreater(v.s6, 5.0));
               results.s7 = select(v2.s7, v1.s7, isgreater(v.s7, 5.0));
  
               vstore8(results, 0, output);
  
      }
      else {
          /*does some other stuff that i haven't get to*/
      }
  
  
  }
  </code></pre>