title: Why the data downloading is much slower than the uploading on GPU by using OpenCL?
body: <p>I'm a beginner of OpenCL for image processing, I use Win7+VS2010+OpenCL2.0+OpenCV247.
  The platform in my PC is intel i7 CPU + NvidIA GTX760.</p>
  
  <p>Here is my work:</p>
  
  <ol>
  <li><p>I used opencv to read image(1920*1080) from video, then copy image data and get the data pointer.</p>
  
  <pre><code>uchar* input_data=(uchar*)(gray_image-&gt;imageData);
  </code></pre></li>
  <li><p>Then I want do some convolution and other image processing works on GPU, so I used OpenCL to upload this data(input_data) to the device memory(cl_input_data) which has been created before. The uploading step takes about <strong>0.2ms</strong>, it is fast. </p>
  
  <pre><code>clEnqueueWriteBuffer(queue, cl_input_data, 1,
      0, ROI_size*sizeof(cl_uchar), (void*)input_data, 0, 0, NULL);
  </code></pre></li>
  <li><p>The main processing works on several kernels, and each of them takes less than 0.1ms which are all quite normal.</p>
  
  <pre><code>clEnqueueNDRangeKernel( queue,kernel_box,2,NULL,global_work_size,local_work_size, 0,NULL, NULL);
  </code></pre></li>
  <li><p>After all the processing, I want to download the GPU memory(cl_output_data) to host(output_data), and this step it takes over <strong>5.5ms</strong>! Which is nearly 27 times slower than the data uploading step!</p>
  
  <pre><code>clEnqueueReadBuffer( queue,cl_output_data,CL_TRUE,0,ROI_size * sizeof(char),(void*) output_data,0, NULL, NULL );
  </code></pre></li>
  </ol>
  
  <p>So, I'm just wondering, since I used the same device and the data size was exactly the same, why the uploading and downloading data's time is so different?</p>
  
  <p>Oh, by the way, the time testing tool I used is something like QueryPerformanceFrequency(&amp;m_Frequency);</p>
  
  <p>Thank you!</p>