New Issue: Control forall parameters using a context manater?

20337, "vasslitvinov", "Control forall parameters using a context manater?", "2022-07-29T22:45:24Z"

Currently I can control some parameters of how a forall over a domain is executed, for example:

forall i in D.these(tasksPerLocale=5) { ...... }

What about the situation where the forall loop is in a library function and the application code wants to set its tasksPerLocale parameter? Obviously, the library function can have a tasksPerLocale formal. However this does not look scalable because now this formal may need to be propagated through several levels of calls before reaching a forall. Also, as foralls start getting more control knobs -- think GPUs -- libraries will need to be updated to cater to these extensions and changes well.

Instead, I propose that the caller of the library function controls the settings via a context manager. For example:

manage forallControls(tasksPerLocale=5) {
  libraryFunction(....);
}

The proposal is that with this code the participating parallel iterators will take tasksPerLocale=5 into consideration.