[Rcpp-devel] Nesting RcppParallel Worker objects and oversubscription
Kumar MS
mskb01 at gmail.com
Sun May 24 23:56:13 CEST 2026
Hello,
I have an Rcpp function that nests RcppParallel workers. ( I am doing
cross-validation. The outer worker parallelizes over a grid of
hyperparameter values, and the inner worker parallelizes over folds ).
Before calling this function, I do a
`RcppParallel::setThreadOptions(6)` to set a desired number of threads
of six. However, I observe that whenever the nested worker gets
called, the total number of threads goes much higher (~12 or higher)
with CPU usage shooting to ~1200% on an M4 Mac with the code compiled
and linked against Homebrew's intel tbb.
I have also tried `tbb::global_control
ctll(tbb::global_control::max_allowed_parallelism, 6);` I see the same
behavior.
It appears nesting ignores the global setting?
Thank you,
Kumar
More information about the Rcpp-devel
mailing list