take default threads from CRAN env var #5807
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.5
which 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 runsetDTthreads
in tests/examples/vignettes).