gvegayon / parallel

PARALLEL: Stata module for parallel computing
https://rawgit.com/gvegayon/parallel/master/ado/parallel.html
MIT License
117 stars 26 forks source link

Update global variable to remove reference to clusters #77

Closed bquistorff closed 5 years ago

bquistorff commented 5 years ago

Along with the overall move from "clusters" to "children" we should probably also change PLL_CLUSTERS to something like PLL_CHILDREN. Our previous api changes we could allow backwards compatibility so do we want to do that here and define both (and deprecate the old one for later removal)?

gvegayon commented 5 years ago

Perhaps we could have both. Not sure though if someone is actively using those macros.

bquistorff commented 5 years ago

OK, let's do both and deprecate one. Let's make the change before resubmission.

gvegayon commented 5 years ago

OK. One thing that I've been doing lately is to use a function to retrieve a constant that I'm planning to use around, so if I make changes to it's definition or something, I just need to change it in a single place (e.g. https://github.com/USCbiostats/sluRm/blob/92d56d925774371c01d106a3f885af820d498952/R/utils.R#L202-L222). We could have something like a function as:

prog def pll_get_numbers, rclass
   if ("$PLL_CLUSTERS" != "") {
      return local ncores = $PLL_CLUSTERS
      di "PLL_CLUSTERS is deprecated. Will be removed in the future. Please use PLL_CHILDREN instead."
   } else if ("PLL_CHILDREN" != "") return local ncores = $PLL_CHILDREN
end

Or something like this. This could be even defined in MATA and have a wrapper in Stata both share the same thing. In the case of Stata, the function can be called at the begining of the routine, whereas in mata we can just return the number.

bquistorff commented 5 years ago

3bcfd8858eca1b34151ee26da05d7aa1e884a8fb