[關鍵字]: Rcpp, parallel computing
[出處]: http://rcppcore.github.io/RcppParallel/#examples
[重點摘要]:
RcppParallel provides a complete toolkit for creating portable,
high-performance parallel algorithms without requiring direct manipulation of
operating system threads. RcppParallel includes:
Intel Thread Building Blocks (v4.3), a C++ library for task parallelism with
a wide variety of parallel algorithms and data structures (Windows, OS X,
Linux, and Solaris x86 only).
TinyThread, a C++ library for portable use of operating system threads.
RVector and RMatrix wrapper classes for safe and convenient access to R data
structures in a multi-threaded environment.
High level parallel functions (parallelFor and parallelReduce) that use Intel
TBB as a back-end on systems that support it and TinyThread on other
platforms.
我自己試做了用RcppArmadillo配上RcppParallel:
http://pastebin.com/KLwySJey
http://pastebin.com/PPhkVv6x (只有p小時會快,p變大會漸慢)