在clEnqueueNDRange内核中未指定OpenCL使用的大小时,clGetKernelWorkGroupInfo-CL_KERNEL_WORK_GROUP_SIZE是多少? [英] is clGetKernelWorkGroupInfo - CL_KERNEL_WORK_GROUP_SIZE the size OpenCL uses when not specifying it in clEnqueueNDRange Kernel?

查看:105
本文介绍了在clEnqueueNDRange内核中未指定OpenCL使用的大小时,clGetKernelWorkGroupInfo-CL_KERNEL_WORK_GROUP_SIZE是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我读到,当在排队内核时未指定工作组大小时,OpenCL会为我选择一个.

I read that when not specifying the work group size when enqueueing a kernel, OpenCL chooses one for me.

例如:

//don't know which workgroup size OpenCl will use!
clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &global_size, NULL, 0, NULL, NULL);

有没有一种方法可以获取OpenCL在这里使用的工作组大小? OpenCL是由clGetKernelWorkGroupInfo返回的工作组大小吗?

Is there a way to get the workgroup size OpenCL is using here? Is the workgroup size OpenCL chooses the one which is returned by clGetKernelWorkGroupInfo?

提前谢谢!

推荐答案

CL_KERNEL_GLOBAL_WORK_SIZE是您可以获得的 MAXIMUM 工作组大小,具体取决于内核的内存要求.

CL_KERNEL_GLOBAL_WORK_SIZE is the MAXIMUM work-group size you can get, which depends on the memory requirements of your kernel.

如果在执行内核时未指定工作组的大小,OpenCL将尝试为您选择最佳的大小, MAY MAY NOT 大小.

If you do not specify a work-group size when executing a kernel OpenCL will try to choose the best one for you, which MAY or MAY NOT be the maximum size.

实际上,只有与设备的计算单元数量相比,您有很多工作项时,使用最大大小才是最佳选择.

Indeed using the maximum size is optimal only if you have a lot of work-items compared to the number of compute-units of the device.

这篇关于在clEnqueueNDRange内核中未指定OpenCL使用的大小时,clGetKernelWorkGroupInfo-CL_KERNEL_WORK_GROUP_SIZE是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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