06-18-2009, 03:47 PM
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 ?
06-22-2009, 08:41 PM
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);
clEnqueueRead(cmd2, buffer, CL_FALSE, 0, size(cl_int), &out_data, 1, &event1, &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.
06-23-2009, 07:47 AM
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 ?
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.