CRAN sometimes dings packages if they use more than getOption("Ncpus") cores in an example (and CRAN sets that option to what they consider a "reasonable" value for CRAN check testing). This is documented for example in ?tools::check_packages_in_dir. For example they recently dinged {piecepackr} for naively using rayrender::render_scene() in an example because I didn't explicitly turn set parallel=FALSE or manually restrict the number of cores in my example with something like options(cores = getOption("Ncpus")). If {rayrender} also allowed number of cores to be set by getOption("Ncpus") then I think future package developers using render_scene() in an example wouldn't need to manually think about throttling the number of cores in their example.
In particular currently {rayrender} uses the following logic to set number of cores:
if (!is.null(options("cores")[[1]])) {
numbercores = options("cores")[[1]]
}
else {
numbercores = parallel::detectCores()
}
if (!parallel) {
numbercores = 1
}
And I'm proposing instead (for ease of reading I'll perhaps incorrectly assume you defined or imported the %||% operator) the following variant logic which I think would keep CRAN happy without developers using render_scene() need to worry about cores in examples:
getOption("Ncpus")
cores in an example (and CRAN sets that option to what they consider a "reasonable" value for CRAN check testing). This is documented for example in?tools::check_packages_in_dir
. For example they recently dinged{piecepackr}
for naively usingrayrender::render_scene()
in an example because I didn't explicitly turn setparallel=FALSE
or manually restrict the number of cores in my example with something likeoptions(cores = getOption("Ncpus"))
. If{rayrender}
also allowed number of cores to be set bygetOption("Ncpus")
then I think future package developers usingrender_scene()
in an example wouldn't need to manually think about throttling the number of cores in their example.In particular currently
{rayrender}
uses the following logic to set number of cores:And I'm proposing instead (for ease of reading I'll perhaps incorrectly assume you defined or imported the
%||%
operator) the following variant logic which I think would keep CRAN happy without developers usingrender_scene()
need to worry about cores in examples: