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
?
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.