clEnqueueMarkerWithWaitList用法 [英] clEnqueueMarkerWithWaitList usage

查看:116
本文介绍了clEnqueueMarkerWithWaitList用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近读了一本关于OpenCL和队列同步方法的书,但是我不了解使用clEnqueueMarkerWithWaitList和clWaitforEvents之间的区别.

I recently read a book about OpenCL and queue synchronizing methods, but I didn't understand difference between using clEnqueueMarkerWithWaitList and clWaitforEvents.

例如,在下面的示例中,kernel_2实例的执行取决于将两个缓冲区clmem_A和clmem_B写入设备.我不了解删除clEnqueueMarkerWithWaitList命令并将clwaitforEvents的参数更改为write_event时有什么区别.

For example, in the below example, The kernel_2 instance's execution is dependent on writing of two buffers clmem_A and clmem_B to the device. I don't understand what is the difference when we delete the clEnqueueMarkerWithWaitList command and change the argument of clwaitforEvents to write_event.

cl_event write_event[2];
clEnqueueWriteBuffer(queue, clmem_A, ***, &write_event[0] );
clEnqueueWriteBuffer(queue, clmem_B, ***, &write_event[1] );
clEnqueueMarkerWithWaitList (queue, 2, write_event, &marker); //deleting this command
clEnqueueNDRangeKernel(queue, kernel_1, *** );
clWaitForEvents(1, &marker);// and replace marker with write_event
clEnqueueNDRangeKernel(queue, kernel_2, *** );

我相信在两种情况下,kernel_2都将在写入设备后执行,并且如果队列混乱,kernel_1可以同时执行.

I believe in both cases the kernel_2 will execute after writing to device and kernel_1 could execute concurrently if the queue is out of order.

推荐答案

是的,那是等效的.

clEnqueueMarkerWithWaitList是OpenCL 1.2中的新功能,并且比clWaitForEvents具有更大的灵活性,因为您可以携带单个事件而不是它们的集合.

clEnqueueMarkerWithWaitList is new starting in OpenCL 1.2 and offers more flexibility than clWaitForEvents in that you can carry around a single event rather than a collection of them.

如果您为OpenCL 1.1编码(例如,由于NVIDIA落后于行业),则不能使用clEnqueueMarkerWithWaitList.

If you code for OpenCL 1.1 (e.g., because of NVIDIA lagging the industry) you can't use clEnqueueMarkerWithWaitList.

这篇关于clEnqueueMarkerWithWaitList用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆