chapel-lang / chapel

a Productive Parallel Programming Language
https://chapel-lang.org
Other
1.79k stars 420 forks source link

leader/follower improvements aka leader/follower 2.0 #11505

Open mppf opened 6 years ago

mppf commented 6 years ago

As a Chapel user, I'd like to be able to easily implement leader/follower iterators for my types and combine leader/follower iterators from different types.

This epic tracks leader-follower areas of improvement. (Hopefully over time these are split into their own issues to discuss solutions but I'm just putting them here to save time).

What are known issues with leader/follower?

Main Issues

Other related issues

mppf commented 6 years ago

@vasslitvinov, @daviditen FYI. I hope we can record thoughts about leader/follower design problems here and link to issues discussing solutions.

mppf commented 4 years ago

The leader/follower paper has some thoughts in its Future Work section:

One ... limitation is related to zippered iteration over multidimensional data structures. Because zippered serial iteration is implemented via methods on an object, the multidimensional control flow is pushed into the object’s single advance method,which is then zippered with all of the other objects’ methods in a 1D loop. This results in a suboptimal control structure compared to the loop nest a programmer would manually write for a multi dimensional zippered iteration. To that end, we anticipate extending the leader-follower interface to support distinct iterators for each dimension. Multidimensional loop nests would then be generated by zippering each dimension’s iterators separately.

A second concern relates to parallel loop startup overhead.Since each forall loop leader creates parallelism, tasks are created and destroyed for each forall loop. By breaking the leader iterator into two calls—one to create tasks, and the other to assign work to them—the compiler could fuse multiple forall loops, inserting appropriate synchronization to maintain correct semantics while reusing the same tasks.

In both of these scenarios, there will be a need to share state between the collection of iterators that define the leader and followers. To that end, we anticipate moving to more of an object-based framework for leader-follower iterators in which the various iterators would be defined as methods fulfilling an iterator interface. This would also solve some of the awkwardness of grouping iterators via overloading and the compiler-provided tag argument.

bradcray commented 4 years ago

It's not a publicly available document, but for those on the HPE team, 2014-04-21-leader-follower.txt has notes on this general topic as well. Let me know if you need a pointer to it.