[Rd] How can a package be aware of whether it's on CRAN
Dipterix Wang
d|pter|x@w@ng @end|ng |rom gm@||@com
Tue Nov 23 20:11:28 CET 2021
Dear R wizards,
I recently received an email from Prof. Ripley. He pointed out that my package seriously violates the CRAN policy: "using 8 threads is a serious violation of the CRAN policy”. By default the number of cores my package uses is determined from system CPU cores. After carefully reading all the CRAN policies, now I understand that CRAN does not allow a package to use more than 2 CPU cores when checking a package. I can easily change my code to let my tests comply to that constraint.
However, this warning worries me because my package uses OpenMP. I got “caught" partially because I printed the number of cores used in the package startup message, and one of my test exceeded the time limit (which leads to manual inspection). However, what if I develop a package that imports on those openmp-dependent packages? (For example, data.table, fst…) These packages use more than 2 cores by default. If not carefully treated, it’ll be very easy to exceed that limit, and it’s very hard for CRAN to detect it.
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?
Best,
- Dipterix
More information about the R-devel
mailing list