Reputation: 15772
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
?
Upvotes: 7
Views: 462
Reputation: 21128
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.
Upvotes: 1