Hello, I am new to Opencl, I use to code using numpy and I am dealing with stack of images. At the end I have 3D float array of the size (m,n,n). I made my first customized kernel and it works like a charm and it's so fast, I love it!
Now I am converting other algorithm and many of them has operation over a given axis. I also realized that I need to use scan. Now, I am stuck with cumsum along a given axis : data is a float array (m,n,n). I would like to compute like in numpy : numpy.cumsum(data, axis=0) to perform for every pixel of my 3D stack a cumsum along m direction In the Pyopencl documentation : https://documen.tician.de/pyopencl/a...edefined-scans <https://documen.tician.de/pyopencl/algorithm.html#predefined-scans>, there is an example : Code : knl = InclusiveScanKernel(context, np.int32, "a+b") n = 2**20-2**18+5 host_data = np.random.randint(0, 10, n).astype(np.int32) dev_data = cl_array.to_device(queue, host_data) knl(dev_data) assert (dev_data.get() == np.cumsum(host_data, axis=0)).all() This code works for 1D input data, but I do not know how ot perform scan along a given direction of n dim array. I hope someone could help me and teach the right "opencl" approach for such operation Thanks, Jérôme
_______________________________________________ PyOpenCL mailing list PyOpenCL@tiker.net https://lists.tiker.net/listinfo/pyopencl