I am using OpenCL (Xcode, Intel GPU), and I am trying to implement a kernel that calculates moving averages and deviations. I want to pass several double arrays of varying lengths to the kernel. Is this possible to implement, or do I need to pad smaller arrays with zeroes so all the arrays are the same size?
I am new to OpenCL and GPGPU, so please forgive my ignorance of any nomenclature.
You can pass to the kernel any buffer, the kernel does not need to use it all. For example, if your kernel reduces a buffer you can query at run time the amount of work items (items to reduce) using
get_global_size(0)
. And then call the kernel with the proper parameters.An example (unoptimized):
Then you can call it like this.