Results 1 to 4 of 4

Thread: Undefined buffer object location ?

  1. #1
    Junior Member
    Join Date
    Jun 2009
    Posts
    4

    Undefined buffer object location ?

    Considering the next setup:
    - an OpenCL context created on 2 devices.
    - creating a buffer object on the context.

    On which device the buffer was created ?
    The clCreateBuffer () associates the buffer with the context but does not define the device.

    Am I missing something ?

    thanks !

  2. #2
    Junior Member
    Join Date
    Apr 2009
    Posts
    27

    Re: Undefined buffer object location ?

    The buffer is allocated on both devices and OpenCL provides a guranteee that the memory between the two devices is consistent. For example, given a context that has two assocated devices, with command queues cmd1 and cmd2, respectively, then the following is valid:

    cl_int in_data = 0x20;
    cl_int out_data = 0x0;
    cl_event event1, event2;
    cl_mem buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int), NULL, NULL);

    clEnqueueWrite(cmd1, buffer, CL_FALSE, 0, sizeof(cl_int), &in_data, 0, NULL, &event1);

    clFlush(cmd1);

    clEnqueueRead(cmd2, buffer, CL_FALSE, 0, size(cl_int), &out_data, 1, &event1, &event2);

    clWaitForEvents(1, &event2);

    At this point the expression (out_data == in_data) will evaluate to true. The key point to note is that we preformed a write on cmd1 and a read on cmd2. More detail on why this works can be found in Appendix A of the 1.0 specification.

  3. #3
    Junior Member
    Join Date
    Jun 2009
    Posts
    4

    Re: Undefined buffer object location ?

    Thank you for your response, it clarified my question !

    Can we expect that in the future GPUs the synchronization will be made using PCIe point to point transfer ?

    Petru

  4. #4
    Senior Member
    Join Date
    Jul 2009
    Location
    Northern Europe
    Posts
    311

    Re: Undefined buffer object location ?

    PCIe point-to-point transfers are a performance optimization that would certainly be appealing, but it's up to the individual vendors to implement this, so it will depend on whose OpenCL you are using.

Similar Threads

  1. Buffer Object
    By Egibert in forum OpenGL ES 2X - for programmable 3D graphics pipelines
    Replies: 0
    Last Post: 08-08-2011, 01:55 PM
  2. How to move Rectangle from one location to other location?
    By mnarkhede in forum OpenGL ES general technical discussions
    Replies: 5
    Last Post: 04-08-2008, 06:41 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •