MATLAB: Efficient method of summing the values in multiple images on GPU

gpugpuarrayimage processingImage Processing ToolboxMATLABparallel computingParallel Computing Toolbox

I have a series of images sitting on GPU in a 71x71x5000 matrix.
Is there an efficient method of finding the sum of all elements in each 71×71 image on the GPU?
I wanted to do something similar to this but it isn't so simple.
sums = pagefun(@sum, images)

Best Answer

I don't have a machine with the GPU capabilities with me right now, but I think this should work:
sums = pagefun(@(x) sum(x(:)),images);