New Issue: Barrier module stabilization - scalable initializer

18863, "ronawho", "Barrier module stabilization - scalable initializer", "2021-12-14T20:56:55Z"

Today the barrier initializer just takes the number of tasks participating in the barrier.

proc init(numTasks: int, barrierType: BarrierType = BarrierType.Atomic, reusable: bool = true)

Because only a number of tasks is specified, this really constrains the implementation to having a global counter that lives on a single locale, where what you really want in distributed contexts is some sort of tree-based or dissemination barrier. If the initializer included which locales and how many tasks per locale will participate we can provide a pretty optimized implementation. Expanding that a little further, just knowing how many tasks per locale participate still limits you to some sort of shared counter within a node and you could optimize further if for instance each task had a unique ID.

Here I'm proposing that we add something that takes the locales and the number of tasks per-locale. Something like:

/* Like the current API, not expected to be scalable, but simple to use for
 * local barriers */
proc init (numTasks: int, ...) { }

/* Take an array of ints to specify how many tasks will be participating per
 * locale. 0 means exclude that locale */
proc init (participants: [LocaleSpace] int, ...) { }