Conversation
According to reports in our GH this is not guaranteed. They ended up setting threads to 1 or putting examples into dontrun. I don't like proposed change because it is rather unexpected (when possibly not solving the CRAN problem). One may think that setting that particular env var will not impact his/her data pipelines, but only R CMD check. A DT user may expect their |
|
Thanks for letting us know. I think we will get sample reply. Those, and any others vars, should not be used to detect if pkg check runs on CRAN or not, so it is rather not surprising. |
|
thanks for the info, that is helpful. |

Closes #5658
(already closed but actually still an issue)
DT currently takes default number of threads from env vars OMP_THREAD_LIMIT or OMP_NUM_THREADS, as defined in src/openmp-utils.c
CRAN does not allow using more than two CPUs during checks. Previously it had set OMP_THREAD_LIMIT=2 see #5658 (comment)
Recently CRAN stopped setting OMP_THREAD_LIMIT, but it does set
_R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_=2.5which I propose in this PR to examine, round down, and use as a default for the DT number of threads.Currently packages which use DT in tests/examples/vignettes need to run
setDTthreads(2)to get CRAN checks to pass. After merging this PR, the default would satisfy CRAN (package which use DT would no longer need to runsetDTthreadsin tests/examples/vignettes).