title: Memory transfer between host and device in OpenCL?
body: <p>Consider the following code which creates a buffer memory object from an array of double's of size size:</p>
  
  <pre><code>coef_mem = clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, (sizeof(double) * size), arr, &amp;err);
  </code></pre>
  
  <p>Consider it is passed as an arg for a kernel. There are 2 possibilities depending on the device on which the kernel is running:</p>
  
  <ol>
  <li>The device is same as host device</li>
  <li>The device is other than host device</li>
  </ol>
  
  <p>Here are my questions for both the possibilities:</p>
  
  <ul>
  <li>At what step is the memory transferred to the device from the host?</li>
  <li>How do I measure the time required for transferring the memory from host to device?</li>
  <li>How do I measure the time required for transferring the memory from
  device's global memory to private memory?</li>
  <li>Is the memory still transferred if the device is same as host device?</li>
  <li>Will the time required to transfer from host to device be greater
  than the time required for transferring from device's global memory
  to private memory?</li>
  </ul>