开发者

Using a global_work_offset in clEnqueueNDRangeKernel

I have a global work size of 1000 but i want only to execute the kernel from 200 to 1000.

size_t global_work_size = 1000;
size_t global_work_offset = 200;
clEnqueueNDRangeKernel(cpu_queue, kernel [0], 1, &a开发者_开发技巧mp;global_work_offset, &global_work_size, NULL, 0, NULL, NULL);

The problem is it does compute the whole 0-1000 range even if I specify an offset. I tried using:

size_t global_work_offset [1] = {200}; but still no luck. 


You should notice the difference between that parameter in CL 1.0 and 1.1:

CL 1.0:

global_work_offset Must currently be a NULL value. In a future revision of OpenCL, global_work_offset can be used to specify an array of work_dim unsigned values that describe the offset used to calculate the global ID of a work-item instead of having the global IDs always start at offset (0, 0,... 0).

CL 1.1:

global_work_offset global_work_offset can be used to specify an array of work_dim unsigned values that describe the offset used to calculate the global ID of a work-item. If global_work_offset is NULL, the global IDs start at offset (0, 0, ... 0).

So, check that you have a CL 1.1 device and drivers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜