Results 1 to 2 of 2

Thread: Multiple calls to enqueueReadBuffer return different results

  1. #1
    Junior Member
    Join Date
    Nov 2016
    Posts
    6

    Multiple calls to enqueueReadBuffer return different results

    By my understanding, multiple calls to enqueueReadBuffer should return the same result because the buffer will be written to an allocated array present in the host.
    And the second call should just overwrite the previous without changing the results since nothing has changed in the device.

    The code is basically:
    Code :
    n->out= new cl::Buffer(neuron_data->ocl->context, CL_MEM_READ_WRITE, image_width*image_height*sizeof(float));
     
    queue.enqueueReadBuffer(*(n->out), CL_TRUE, 0, n->image_width*n->image_height*sizeof(float),n->last_output);
     
    //process the last_output on the host here
    //print 
     
    queue.enqueueReadBuffer(*(n->out), CL_TRUE, 0, n->image_width*n->image_height*sizeof(float),n->last_output);
     
    //process the last_output on the host here
    //print again (this time the result differs)

    Did I misread the documentation?

  2. #2
    Junior Member
    Join Date
    Nov 2016
    Posts
    6
    Quote Originally Posted by zweifel View Post
    By my understanding, multiple calls to enqueueReadBuffer should return the same result because the buffer will be written to an allocated array present in the host.
    And the second call should just overwrite the previous without changing the results since nothing has changed in the device.

    The code is basically:
    Code :
    n->out= new cl::Buffer(neuron_data->ocl->context, CL_MEM_READ_WRITE, image_width*image_height*sizeof(float));
     
    queue.enqueueReadBuffer(*(n->out), CL_TRUE, 0, n->image_width*n->image_height*sizeof(float),n->last_output);
     
    //process the last_output on the host here
    //print 
     
    queue.enqueueReadBuffer(*(n->out), CL_TRUE, 0, n->image_width*n->image_height*sizeof(float),n->last_output);
     
    //process the last_output on the host here
    //print again (this time the result differs)

    Did I misread the documentation?
    Problem found elsewhere.
    I tried but could not find a way to either delete or change its title to [solved].
    Please do it if you can.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean