Given that OpenCL is meant to be an API for heterogeneous programming, it by almost definition has a huge latency penalty associated with it. Therefore there MUST be an asynchronous API for it.
I am however finding it difficult to find the asynchronous API in OpenCL.net. I have found the OpenCl.Net.Event
struct, which seems to be an out
parameter in most API calls. However I can't find anyway to associate a callback on the event, as it seems clSetEventCallback
is missing from opencl.net
.
Does anyone know how to await
an asynchronous operation in opencl.net
?
Although REST proved to be much easier to implement than other comms (notably the XML-based SOAP), it has an inherent disadvantage in that it is synchronous in nature, rather than asynchronous. “A client sends a request, the server sends a response,” Roper said, describing how REST works.
Asynchronous Writes. Synchronous API calls are blocking calls that do not return until either the change has been completed or there has been an error. For asynchronous calls, the response to the API call is returned immediately with a polling URL while the request continues to be processed.
REST clients can be implemented either synchronously or asynchronously. Both MicroProfile Rest Client and JAX-RS can enable asynchronous clients. A synchronous client constructs an HTTP structure, sends a request, and waits for a response.
More users means more requests, and a litany of competing priorities from an application perspective. Asynchronous APIs help tackle this challenge. These APIs allow relatively time-consuming requests to process in the background while other requests are made.
I don't know much about OpenCL.net, but isn't the CommandQueue
what you are looking for? You can enqueue all your aynch tasks a fait with the Finish
command until all tasks are finished?
For example here: GPGPU image processing basics using OpenCL.NET under The image processing part
For clSetEventCallback i only found clFinish or clWaitForEvents.
Refering to your statement:
as it seems clSetEventCallback is missing from opencl.net
I could not find any way to do what you want, sorry.
EDIT: This seems to be very intestring: Google-Code / GPUTracer. You should take a look at OpenCL.cs and Event.cs. I think they solved your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With