When submitting R packages for verification to CRAN, we receive (on multiple packages), the following results:
* checking tests ... [114s/21s] NOTE
Running ‘testthat.R’ [114s/21s]
Running R code in ‘testthat.R’ had CPU time 5.6 times elapsed time
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ... OK
* checking re-building of vignette outputs ... [165s/26s] NOTE
Re-building vignettes had CPU time 6.4 times elapsed time
Suggesting that the code was executed in a multi-threaded fashion. However, in all our code-calls, we set the number of threads to 1. We have double checked this, and now also return the number of threads after executing back to 1. To no avail.
Our packages use tbb in Rcpp, and we set the number of threads on the R side through:
RcppParallel::setThreadOptions(num_threads)
And collect the number of threads on the Rcpp side through:
auto* nt_env = std::getenv("RCPP_PARALLEL_NUM_THREADS");
auto num_threads = (nullptr == nt_env)
? tbb::task_arena::automatic
: static_cast<size_t>(std::atoi(nt_env));
auto global_control = tbb::global_control(tbb::global_control::max_allowed_parallelism,
num_threads);
Parallelization inside the Rcpp code is then invoked through tbb::parallel_for .
It seems however that at the check at CRAN (Debian, Clang 20), the global control doesn't work, and multiple threads are still created.
I can not replicate this issue on macos (my machine) or on rhub (no multi threading) or GHA (no multi threading).
Is this a known issue // are we setting something up incorrectly somewhere?
When submitting R packages for verification to CRAN, we receive (on multiple packages), the following results:
Suggesting that the code was executed in a multi-threaded fashion. However, in all our code-calls, we set the number of threads to 1. We have double checked this, and now also return the number of threads after executing back to 1. To no avail.
Our packages use tbb in Rcpp, and we set the number of threads on the R side through:
And collect the number of threads on the Rcpp side through:
Parallelization inside the Rcpp code is then invoked through
tbb::parallel_for.It seems however that at the check at CRAN (Debian, Clang 20), the global control doesn't work, and multiple threads are still created.
I can not replicate this issue on macos (my machine) or on rhub (no multi threading) or GHA (no multi threading).
Is this a known issue // are we setting something up incorrectly somewhere?