0

In OpenCL, how can I know the exact size of the local work group during the runtime? clGetKernelWorkGroupInfo seems only return you the maximum possible size, see https://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetKernelWorkGroupInfo.html

CL_KERNEL_COMPILE_WORK_GROUP_SIZE of the above documents will give (0,0,0) if you haven't specified the size.

colddie
  • 1,029
  • 1
  • 15
  • 28
  • Maybe this link will help You: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0538e/BABFIGJE.html "If your application is not required to share data among work-items, set the local_work_size parameter to NULL when enqueuing your kernel. This enables the OpenCL driver to determine the most efficient work-group size for your kernel." also this link would be helpful http://stackoverflow.com/questions/13496681/is-clgetkernelworkgroupinfo-cl-kernel-work-group-size-the-size-opencl-uses-whe – MNie Mar 11 '15 at 08:24
  • @Tadek Thanks. So basically it means the program will choose for you when compiled. There is no way to know what is this 'determined' size? – colddie Mar 11 '15 at 09:08
  • possible duplicate of [Local workgroup size = NULL OpenCL](http://stackoverflow.com/questions/28811839/local-workgroup-size-null-opencl) – user703016 Mar 11 '15 at 09:42

1 Answers1

0

You may query maximal available size of work group with clGetKernelWorkGroupInfo:

size_t max_available_local_wg_size;
cl_int ret = clGetKernelWorkGroupInfo(kernel, device_id, CL_KERNEL_WORK_GROUP_SIZE, sizeof(size_t),                 &max_available_local_wg_size, NULL);

Though, if you don't set the value by hand, implementation will choose it by itself. Usually, you can get actual work group size with profiler, which comes with OpenCL SDK from vendor.

Roman Arzumanyan
  • 1,784
  • 10
  • 10