Source

Branch

1/ @SpikyCaterpillr

@AgileJebrim

I have no meaningful GPU coding experience. That said, if it’s a LARGE array in GPU memory, the obvious guess would be “tell several compute units to sum chunks of it in parallel, then add the outputs together”. The optimum chunk size will vary by GPU and possibly other factors.

2/ @AgileJebrim

@SpikyCaterpillr

“tell several compute units to sum chunks of it in parallel, then add the outputs together”

Any idea how you’d structure it? How would you do this on multicore CPUs using SIMD?

3/ @SpikyCaterpillr

@AgileJebrim

First determine the desired chunk size (I assume compute units have limited addressable space, for one), then iterate over the large array calling starting a summer on each chunk. When I run out of cores or GPU memory, wait and sum what I’ve got before continuing down the array.