Trying to imagine how you would go about implementing summation (or reduction?) on a parallel architecture and am having a difficult time.
Specifically thinking in terms of WebGL arrays of vectors such as this:
[integer1, integer2, integer3, ...]
Wondering if there is a way to do this in parallel
var array = [ 1, 2, 3, 4, 5, ... ]
var sum = 0
array.forEach(function(number){
sum += number
})
return sum
The problem I am encountering is I think mentioned here in this NVidia document on GPU reduction (not quite following):
how do we communicate partial results between thread blocks?
Wondering if one can describe an algorithm that computes the sum of something in parallel, since there is a shared variable that needs to be used somehow (the sum variable). Or perhaps this isn't possible.