Asynchronous buffer reading

OpenCL allows 2 ways in order to read buffer data, blocking or not blocking. The first way is essentially similar to the method used internally in ocland to exchange data, but the second one, that i called asynchronous buffer reading, is really more complex, but i developed this solution…

  1. Server and client must exchange all the parameters (command queue, buffer, sizes, …).
  2. Server must allocate memory and call to clEnqueueReadBuffer, recovering inmediately the control because is a not blocking operation.
  3. Then the server opens a new socket on a new port, and reports it to the client (the memory transfer done asynchronously can’t interfere with the following client commands).
  4. Client opens a new connection in the purposed socket.
  5. Server and client opens a new thread in order to don’t block the execution while data is transfered.
  6. Server waits until OpenCL reports that memory is available.
  7. Server sends the data to the client in the new thread using the new connection.
  8. Server marks the work as done.

In order to the scheme purposed can run, I needed to develope the ocland_event, a layer over the OpenCL cl_event entity. This new layer stores the cl_event associated, and a status flag. Since both cl_event and ocland_event are pointers, the client never will know that transfered event is in reallity an ocland_event, and will use it as a truly cl_event, and when calls to wait over the event, server knows that must wait for the ocland_event, and then for the internally stored cl_event.

This entry was posted in Development, Features and tagged , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s