work group size question.."CL_INVALID_WORK_GROUP_SIZE"

In my source code, I just use two work-items.
global work size is 50 and local work size is also 50.

But I’m not success in my source code. :cry:

If I call the clEnqueueNDRangeKernel() function, this source code is occured “CL_INVALID_WORK_GROUP_SIZE” error.

I don’t know why is occured the error.

Please, tell me an advice.

Can you show us the parameters that you passed to clEnqueueNDRangeKernel()?

Also, have you tried passing 0 as the local_work_size argument to clEnqueueNDRangeKernel()?

Finally, what is the value that is returned when you query CL_DEVICE_MAX_WORK_GROUP_SIZE using clGetDeviceInfo()?

the parameter of clEnqueueNDRangeKernel() is that.


 Set work-item dimensions
	szGlobalWorkSize[0] = (iWidth/16);  //iWidth=800
	szGlobalWorkSize[1] = (iHeight/16); // iHeight = 800
	szLocalWorkSize[0]= NUM_THREADS;  //50
	szLocalWorkSize[1]= NUM_THREADS; //50

err = clEnqueueNDRangeKernel(oclHandles.queue, 
				m_clHexEncodeKernel, 
				2,									NULL,
				szGlobalWorkSize, 
				szLocalWorkSize, 
				0, NULL, NULL); 

I try to use clGetDeviceInfo(), then I get the max work group size.
The max work group size is 512.


// device Info
	size_t returned_size = 0;
	size_t max_workgroup_size = 0;
	err = clGetDeviceInfo(*oclHandles.devices, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(size_t), &max_workgroup_size, &returned_size);
	if (err !=  CL_SUCCESS)
	{
		errMsg.SetString(_T("Error: Failed to retrieve device info!
"));
		return EXIT_FAILURE;
	}

Your problem is that the local size you are using is not really 50, it is 50x50 = 2500, which is way above the hardware limit of 512.

Use a smaller local size or simply pass zero as the local size:

err = clEnqueueNDRangeKernel(oclHandles.queue, 
            m_clHexEncodeKernel, 
            2,                           NULL,
            szGlobalWorkSize, 
            0, 
            0, NULL, NULL);