Open bradcray opened 2 years ago
As a workaround in the meantime, we discussed creating routines:
proc numlocs() param where (CHPL_COMM=="none") {
return 1;
}
proc numlocs() {
return numLocales;
}
and using that in the modulus instead of numLocales
above. We
also discussed that if we had the param(bool)
feature discussed
in https://github.com/chapel-lang/chapel/issues/14639#issuecomment-565529472,
that could be used as a workaround more succinctly than creating the
two overloads above.
A challenge to doing this is that we currently implement, and indicate to the user, that numLocales
is a config const. Of course, it's not a very configurable one in the CHPL_COMM=none case, so there would be some effort in the documentation as well as the coding to explain this clearly.
While talking with a user today, we were talking about coding idioms that would be more or less expensive when used in a single- vs. multi-locale setting. One idiom that was intriguing to me was:
where he was wondering whether he would need to special case this part of the code to avoid the mod for a single-locale run. This made me wonder whether we make
numLocales
aparam
forCHPL_COMM=none
compiles, where it seems that the answer is "no." But it seems like we could and that this could have some minor benefits, doesn't it?