我正在下面1000000×100二维全球工作的大小和1×100如何在OpenCL中声明本地内存?
__kernel void myKernel(
const int length,
const int height,
and a bunch of other parameters) {
//declare some local arrays to be shared by all 100 work item in this group
__local float LP [length];
__local float LT [height];
__local int bitErrors = 0;
__local bool failed = false;
//here come my actual computations which utilize the space in LP and LT
}
然而,这拒绝编译一个地方工作尺寸的OpenCL内核,因为参数length
和编译时不知道height
。但我不清楚如何正确地做到这一点。我应该使用指针与memalloc?如何处理这种内存只能为整个工作组分配一次而不是每个工作项一次?
我需要的是在整个工作组之间共享2个浮点数,1个整数和1个布尔值的数组(所有100个工作项目)。但是我无法找到,这是否正确任何方法...
http://stackoverflow.com/questions/2541929/how-do-i-use-local-memory-in-opencl – 2016-03-31 16:25:26