title: How do images work in opencl kernel?
body: <p>I'm trying to find ways to copy multidimensional arrays from host to device in opencl and thought an approach was to use an image... which can be 1, 2, or 3 dimensional objects. However I'm confused because when reading a pixle from an array, they are using vector datatypes. Normally I would think double pointer, but it doesn't sound like that is what is meant by vector datatypes. Anyway here are my questions:</p>
  
  <p>1) What is actually meant to vector datatype, why wouldn't we just specify 2 or 3 indices when denoting pixel coordinates? It looks like a single value such as float2 is being used to denote coordinates, but that makes no sense to me. I'm looking at the function read_imageui and read_image.</p>
  
  <p>2) Can the input image just be a subset of the entire image and sampler be the subset of the input image? I don't understand how the coordinates are actually specified here either since read_image() only seams to take a single value for input and a single value for sampler.</p>
  
  <p>3) If doing linear algebra, should I just bite the bullet and translate 1-D array data from the buffer into multi-dim arrays in opencl?</p>
  
  <p>4) I'm still interested in images, so even if what I want to do is not best for images, could you still explain questions 1 and 2?</p>
  
  <p>Thanks!</p>
  
  <p><strong>EDIT</strong>
  I wanted to refine my question and ask, in the following khronos documentation they define...</p>
  
  <pre><code> int4 read_imagei (
      image2d_t image,
      sampler_t sampler,
      int2 coord)
  </code></pre>
  
  <p>But nowhere can I find what image2d_t's definition or structure is supposed to be. The samething for sampler_t and int2 coord. They seem like structs to me or pointers to structs since opencl is supposed to be based on ansi c, but what are the fields of these structs or how do I note the coord with what looks like a scala?! I've seen the notation (int2)(x,y), but that's not ansi c, that looks like scala, haha. Things seem conflicting to me. Thanks again!</p>