[Rd] How can a package be aware of whether it's on CRAN
hp@ge@@on@g|thub @end|ng |rom gm@||@com
Tue Nov 23 21:19:19 CET 2021
But why would you need to check for anything in the first place?
If you only use 2 cores in your examples, vignettes, and unit tests, 'R
CMD check' will run fine everywhere and not eat all the CPU power of the
machine where it's running.
On 23/11/2021 12:05, Gábor Csárdi wrote:
> On Tue, Nov 23, 2021 at 8:49 PM Henrik Bengtsson
> <henrik.bengtsson using gmail.com> wrote:
>>> Is there any reliable way to let packages to know if they are on CRAN, so they can set omp cores to 2 by default?
>> Instead of testing for "on CRAN" or not, you can test for 'R CMD
>> check' running or not. 'R CMD check' sets environment variable
>> _R_CHECK_LIMIT_CORES_=TRUE. You can use that to limit your code to run
>> at most two (2) parallel threads or processes.
> AFAICT this is only set with --as-cran and many CRAN machines don't
> use that and I am fairly sure that some of them don't set this env var
> manually, either.
> R-devel using r-project.org mailing list
Bioconductor Core Team
hpages.on.github using gmail.com
More information about the R-devel