run kernel in one NDRange space

Hi forum,

I have the local work size defined and i want to run the kernel in one NDRange index space only .

I am confused within the execution command :

size_t localWorkSize[2] = {64, 64};

// HOW should define the global work size if i need only one NDRange / (Grid, CUDA equivalent)
errNum = clEnqueueNDRangeKernel();

Any idea ?


The dimension of the global work size and the local work size must be the same so you should write something like:

size_t globalWorkSize[1] = { n };
size_t localWorkSize[1] = { 64 };

clEnqueueNDRangeKernel(cmdQueue, kernel, 1, globalWorkSize, localWorkSize, ...)


Ok let me refresh again. I want to execute kernel in one work-group and it is 2 dimensional. As a result, i did not understand your last post. You suggested something 1D instead, isnt it?

Like in CUDA , we write kernel<<<1, thid>>>, where dim3 thid(64,64,1); It means that we are executing one block(Work-group) with 64*64 threads(work-items).

Any more thoughts?


Then you just have to define the same values for the global size and the local size:

size_t globalWorkSize[2] = { 64, 64 };
size_t localWorkSize[2] = { 64, 64 };

clEnqueueNDRangeKernel(cmdQueue, kernel, 2, globalWorkSize, localWorkSize, ...)