Open mppf opened 6 years ago
@vasslitvinov, @daviditen FYI. I hope we can record thoughts about leader/follower design problems here and link to issues discussing solutions.
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.
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.
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
forall (i,j) in zip(1..4, 1..5) { ... }
does not result in an error todayzip
don't use leader/follower iterators right now (issue #13665).This prevents the loop bodies from includingCorrection: As of PR #13664, this is supported, but we still can't zip serial iterators that yield from within on-clauses with other serial iterators.on
statements.param tag
field might seem awkward to users. Maybe the various iterators should be methods on a common type rather than iterators that share a name and argument types. #13256can't zipper with an unbounded iterator, e.g. (#13239)
this
method on a data structure doesn't make it promoteable13147
Other related issues