New Issue: 'ChapelLocale' module: The 'runningTasks()' and 'maxTaskPar' methods.

20219, "jeremiah-corrado", "'ChapelLocale' module: The 'runningTasks()' and 'maxTaskPar' methods.", "2022-07-14T22:19:21Z"

In a recent module review meeting, we looked at locale.runningTasks() and locale.maxTaskPar which query the number of tasks currently running on the locale and the locales maximum number of tasks respectively.

These are commonly used together in patterns like this:

if (here.runningTasks() < here.maxTaskPar) {
// do something in parallel
} else {
// do something sequentially
}

Or their difference (here.maxTaskPar - here.runningTasks()) is used to guide the number of tasks spawned by a parallel construct.

A new method to make the above examples simpler?

We discussed the possibility of including a new method that queries the optimal number of tasks to invoke. The name and exact implementation details were not decided.

It was also noted that such a method would be portable to GPU sub-locales, as it would simply return 1 (there should only be one "task" running on a gpu). This avoids the challenge of developing sensible gpu-implementations for runningTasks and maxTaskPar.

Should runningTasks() and maxTaskPar stick around in conjunction with this new method? If so, we had the following notes about them:

runningTasks()

  • The name should be updated to indicate that this method returns a number, not a list of tasks. Something like numRunningTasks?
  • This should be a paren-less method?

maxTaskPar

  • Can the name be improved?
  • Would maxNumTasks be better, as it mirrors runningTasks more closely?