talira

RcppParallel

Parallel programming tools for Rcpp code in R packages

open sourceGPL-3.0-or-laterfree

RcppParallel gives Rcpp code in R packages high-level parallel functions: parallelFor turns a serial loop into a parallel one and parallelReduce accumulates values across threads. It bundles Intel's TBB (oneTBB) as the back end where it's supported and TinyThread elsewhere, and provides RVector and RMatrix wrappers for reading R data safely from several threads. Install it from CRAN as RcppParallel.

Problems it solves

  • make a slow loop in my R package's C++ code run on all cores
  • parallelise Rcpp code without managing threads myself
  • sum or reduce a large vector in parallel from Rcpp

Features

  • parallelFor and parallelReduce for Rcpp code
  • Intel TBB back end, TinyThread fallback
  • RVector and RMatrix thread-safe wrappers for R data
  • bundles TBB and TinyThread

Alternatives

The same job

These do what RcppParallel does.

  1. future (R) Unified parallel and distributed processing in R
  2. futurize Parallelize R map-reduce calls by piping them into futurize()
  3. Taskflow Header-only C++ library for task-parallel programs on CPUs and GPUs

Compare RcppParallel with the top 3