Error when localworksize to small

Hello,

I just use a example which in increment local variable.

When the localworksize variable are smaller than the globalworksize the execution gave me that error :

Error # -54 (CL_INVALID_WORK_GROUP_SIZE)

on that line :

ciErrNum = clEnqueueNDRangeKernel(cqCommandQueue, ckKernel, 1, NULL, &szGlobalWorkSize, &szLocalWorkSize, 0, NULL, NULL);

on that example I have szGlobalWorkSize = 10 and szLocalWorkSize = 20;

Can someone help me?

Best regard.

Global size should be a multiple of local size. If you don’t actually need interthread communication, you’d better leave it as NULL or as 20.