Frank Maibaum
Frank Maibaum

Reputation: 61

About OpenCL's clEnqueueNDRangeKernel()

Say I have the following code:

size_t globalSize = 4294967295; // (2^(32))-1
clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &globalSize, 0, 0, NULL, NULL);

Doesn't this mean that I want the kernel to be executed 4294967295 times and that OpenCL will decide the most efficient workgroup size?

Upvotes: 2

Views: 509

Answers (1)

pmdj
pmdj

Reputation: 23428

Essentially yes, although you may want to note a few things:

  • Note that the argument following &globalSize is a NULL pointer, not the integer value 0, as the parameter is declared as `const size_t *local_work_size.
  • It won't necessarily be the most efficient workgroup size in all cases; implementations may not be able to predict that fully accurately. They should pick an appropriate/reasonable size, however.
  • Implementations may have runtime limits which may cause the kernel execution to be aborted prematurely, or the device may not support preemption, potentially causing the system to freeze. Gigantic work sizes like that may therefore not be ideal.

Upvotes: 2

Related Questions