File tree Expand file tree Collapse file tree 4 files changed +17
-4
lines changed
Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,10 @@ RcppParallelLibs <- function() {
1616# Inline plugin used by sourceCpp to link to the TBB library
1717inlineCxxPlugin <- function () {
1818 list (
19- env = list (PKG_LIBS = tbbLdFlags()),
19+ env = list (
20+ PKG_CXXFLAGS = " -DRCPP_PARALLEL_USE_TBB=1" ,
21+ PKG_LIBS = tbbLdFlags()
22+ ),
2023 includes = " #include <RcppParallel.h>" ,
2124 LinkingTo = " RcppParallel" ,
2225 body = function ( x ) x ,
Original file line number Diff line number Diff line change @@ -49,9 +49,12 @@ importFrom(RcppParallel, RcppParallelLibs)
4949```
5050
5151Finally, for Windows builds you'll need the following in ** src\\ Makevars.win**
52- to ensure that your package can link against the TBB DLL:
52+ to ensure that your package can use TBB (if you don't do
53+ this the TinyThread fallback implementation will be used):
54+
55+ ``` make
56+ PKG_CXXFLAGS += -DRCPP_PARALLEL_USE_TBB=1
5357
54- ``` makefile
5558PKG_LIBS += $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" \
5659 -e "RcppParallel::RcppParallelLibs() ")
5760```
Original file line number Diff line number Diff line change 66#include " RcppParallel/TinyThread.h"
77
88// Use TBB only where it's known to compile and work correctly
9+ // (NOTE: Windows TBB is temporarily opt-in for packages for
10+ // compatibility with CRAN packages not previously configured
11+ // to link to TBB in Makevars.win)
912#ifndef RCPP_PARALLEL_USE_TBB
10- #if defined(_WIN32) || defined( __APPLE__) || defined(__gnu_linux__)
13+ #if defined(__APPLE__) || defined(__gnu_linux__)
1114#define RCPP_PARALLEL_USE_TBB 1
1215#include " RcppParallel/TBB.h"
1316#else
Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ extern "C" SEXP defaultNumThreads() {
4949
5050#include < tthread/tinythread.h>
5151
52+ extern " C" SEXP setThreadOptions (SEXP numThreadsSEXP, SEXP stackSizeSEXP) {
53+ return R_NilValue;
54+ }
55+
5256extern " C" SEXP defaultNumThreads () {
5357 SEXP threadsSEXP = Rf_allocVector (INTSXP, 1 );
5458 INTEGER (threadsSEXP)[0 ] = tthread::thread::hardware_concurrency ();
You can’t perform that action at this time.
0 commit comments