Open bholt opened 11 years ago
Another thought is to go the other way and associate reduction objects with the GCE.
auto total = Reducer<int,add,&joiner>::create();
forall<&joiner>(array, N, [total](int& e){
total += e;
}); // joiner.wait forces sync to be called on reducer?
VLOG(0) << (int)total; // coercion to get value could also force a sync
I know we've rewritten "reduce" so many times now, but this idea is cool.
Proposing to extend the symmetric address reduce (1181e16571f) with something that's integrated into parallel loops.
Another thing to consider is to make the reduction part of the loop's sync object. So if we supported arbitrary GCE's for loops, you could just make a Reduce sync object and then have the 'return' from the loop lambda be the thing to reduce:
This could be done as part of #119.