High level functions for doing parallel programming with Rcpp. For example, the parallelFor
function can be used to convert the work of a standard serial "for" loop into a parallel one and the parallelReduce
function can be used for accumulating aggregate or other values.
The high level interface enables safe and robust parallel programming without direct manipulation of operating system threads. On Windows, OS X, and Linux systems the underlying implementation is based on Intel TBB (Threading Building Blocks). On other platforms a less-performant fallback implementation based on the TinyThread library is used.
For additional documentation on using RcppParallel see the package website at http://rcppcore.github.io/RcppParallel/.
RcppParallel
now supports the new interface of Intel TBB and allows using external library (e.g., with oneTBB
or the system TBB library), using TBB_LIB
and TBB_INC
environment variables.
To build the development version of RcppParallel
with oneTBB
:
- Install
oneTBB
.
For example, installing oneTBB
on Linux 64-bit (x86_64
) to $HOME
directory (change if needed!):
TBB_VERSION="2021.1.1"
wget https://github.com/oneapi-src/oneTBB/releases/download/v2021.1.1/oneapi-tbb-$TBB_VERSION-lin.tgz
tar zxvf oneapi-tbb-$TBB_VERSION-lin.tgz -C $HOME
export TBB="$HOME/oneapi-tbb-$TBB_VERSION"
- Set the TBB environment variables (specifically:
TBB
for the installation prefix,TBB_INC
for the directory that includes the header files, andTBB_LIB
for the libraries directory).
For example, installing oneTBB
on Linux 64-bit (x86_64
) to $HOME
directory (change if needed!):
source $TBB/env/vars.sh intel64
export TBB_INC="$TBB/include"
export TBB_LIB="$TBB/lib/intel64/gcc4.8"
- Build the development version of
RcppParallel
:
install.packages("remotes")
remotes::install_github("RcppCore/RcppParallel@develop", force = TRUE)
The RcppParallel package is made available under the GPLv2.
The TinyThread library is licensed under the zlib/libpng license as described here.
The Intel TBB Library is licensed under the Apache 2.0 (as described at https://www.threadingbuildingblocks.org/faq/10).