Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Asynchronous API

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?

like image 892
Aron Avatar asked Nov 01 '14 14:11

Aron


People also ask

Is REST API asynchronous or synchronous?

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.

What is synchronous and asynchronous API call?

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.

Are REST API calls asynchronous?

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.

Why API calls should be asynchronous?

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.


1 Answers

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.

like image 199
BendEg Avatar answered Oct 07 '22 09:10

BendEg