简体   繁体   English

异步 API

[英]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.鉴于 OpenCL 旨在成为异构编程的 API,从定义上讲,它几乎具有与之相关的巨大延迟损失。 Therefore there MUST be an asynchronous API for it.因此,它必须有一个异步 API。

I am however finding it difficult to find the asynchronous API in OpenCL.net.然而,我发现在 OpenCL.net 中很难找到异步 API。 I have found the OpenCl.Net.Event struct, which seems to be an out parameter in most API calls.我找到了OpenCl.Net.Event结构,它似乎是大多数 API 调用中的out参数。 However I can't find anyway to associate a callback on the event, as it seems clSetEventCallback is missing from opencl.net .但是,无论如何我都找不到将回调关联到事件上,因为clSetEventCallback中似乎缺少opencl.net

Does anyone know how to await an asynchronous operation in opencl.net ?有谁知道如何在opencl.net await异步操作?

I don't know much about OpenCL.net, but isn't the CommandQueue what you are looking for?我对 OpenCL.net 了解不多,但CommandQueue不是您要找的吗? You can enqueue all your aynch tasks a fait with the Finish command until all tasks are finished?您可以使用“ Finish命令将所有 aynch 任务排入队列,直到所有任务完成?

For example here: GPGPU image processing basics using OpenCL.NET under The image processing part例如这里: GPGPU image processing basics using OpenCL.NET under the image processing part

For clSetEventCallback i only found clFinish or clWaitForEvents.对于clSetEventCallback,我只找到 clFinish 或 clWaitForEvents。

Refering to your statement:参考你的说法:

as it seems clSetEventCallback is missing from opencl.net因为 opencl.net 中似乎缺少 clSetEventCallback

I could not find any way to do what you want, sorry.我找不到任何方法来做你想做的事,抱歉。

EDIT : This seems to be very intestring: Google-Code / GPUTracer .编辑:这似乎非常有趣: Google-Code / GPUTracer You should take a look at OpenCL.cs and Event.cs.您应该看看 OpenCL.cs 和 Event.cs。 I think they solved your problem.我认为他们解决了你的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM