Skip to content

Commit 9c8f102

Browse files
jjallairecran-robot
authored andcommitted
version 4.3.4
1 parent d1a493c commit 9c8f102

31 files changed

+1163
-141
lines changed

DESCRIPTION

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,40 @@
11
Package: RcppParallel
22
Type: Package
3-
Title: Parallel programming tools for Rcpp
4-
Version: 4.3.3
5-
Date: 2014-10-20
6-
Author: JJ Allaire; Romain Francois; Intel, Inc.; Marcus Geelnard
7-
Maintainer: JJ Allaire <jj@rstudio.com>
3+
Title: Parallel Programming Tools for Rcpp
4+
Version: 4.3.4
5+
Date: 2015-04-04
6+
Authors@R: c(
7+
person("JJ", "Allaire", role = c("aut", "cre"), email = "jj@rstudio.com"),
8+
person("Romain", "Francois", role = c("aut", "cph")),
9+
person("Gregory", "Vandenbrouck", role = "aut"),
10+
person("Marcus", "Geelnard", role = c("aut", "cph"),
11+
comment = "TinyThread library, http://tinythreadpp.bitsnbites.eu/"),
12+
person(family = "RStudio", role = "cph"),
13+
person(family = "Intel", role = c("aut", "cph"),
14+
comment = "Intel TBB library, https://www.threadingbuildingblocks.org/"),
15+
person(family = "Microsoft", role = "cph")
16+
)
817
Description: High level functions for doing parallel programming with Rcpp.
918
For example, the parallelFor function can be used to convert the work of
1019
a standard serial "for" loop into a parallel one and the parallelReduce
1120
function can be used for accumulating aggregate or other values.
1221
Suggests: Rcpp, testthat
1322
SystemRequirements: GNU make
1423
License: GPL-2
15-
Collate: 'options.R'
16-
Packaged: 2014-10-21 10:34:48 UTC; jjallaire
24+
URL: http://rcppcore.github.io/RcppParallel,
25+
https://github.com/RcppCore/RcppParallel
26+
Collate: 'build.R' 'hooks.R' 'options.R'
27+
Packaged: 2015-03-06 20:46:09 UTC; jjallaire
28+
Author: JJ Allaire [aut, cre],
29+
Romain Francois [aut, cph],
30+
Gregory Vandenbrouck [aut],
31+
Marcus Geelnard [aut, cph] (TinyThread library,
32+
http://tinythreadpp.bitsnbites.eu/),
33+
RStudio [cph],
34+
Intel [aut, cph] (Intel TBB library,
35+
https://www.threadingbuildingblocks.org/),
36+
Microsoft [cph]
37+
Maintainer: JJ Allaire <jj@rstudio.com>
1738
NeedsCompilation: yes
1839
Repository: CRAN
19-
Date/Publication: 2014-10-21 13:34:38
40+
Date/Publication: 2015-03-07 06:30:42

MD5

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
b775c33072f692c8d3a95fe9b50e836e *DESCRIPTION
2-
e49f750dfa2a5be28d49a7fa7b215bf4 *NAMESPACE
3-
15be4b097ffe3bc175e3d463eff97d0e *NEWS
4-
21283daa4d44c9da3e10b629a90b1f35 *R/options.R
5-
13d88ca7ef614082fb8292cf01ac843b *README.md
6-
d5e3f68646300f0f7445ad858a2127f3 *inst/include/RcppParallel.h
1+
90f4ef09e11df35ad3d0186a974f603d *DESCRIPTION
2+
6684f7af533cedbca1dda7f22759016b *NAMESPACE
3+
574fc74ab44405a8404a32db14c140bc *NEWS
4+
a1f14f6bcc5fc14cc939dbda06421a80 *R/build.R
5+
83138edf5caa198b88268f75e0064b44 *R/hooks.R
6+
cb7259a31eb853ae93044c43fb1cf101 *R/options.R
7+
eb763f5f18fed18a2970e35259a72c83 *README.md
8+
9434681cbb306f86dd071b918ce99e97 *inst/include/RcppParallel.h
79
565df1e5d841a44945867c15c102488e *inst/include/RcppParallel/Common.h
810
c3580014f0ccf1c64a1ae4e773e28ebb *inst/include/RcppParallel/RMatrix.h
911
d38427a7601c227e4d2e19b03cf7badd *inst/include/RcppParallel/RVector.h
@@ -110,11 +112,16 @@ b330f773f10a4bcfa2ef87e413ced34e *inst/include/tbb/tbb_thread.h
110112
36a8c5ad8e670d6c23f41c480b437b56 *inst/include/tthread/fast_mutex.h
111113
bb4edcf03af4d1f5088cdb04d5c622bb *inst/include/tthread/tinythread.h
112114
9d61a54db6779348e55e3725a8782ea4 *inst/include/tthread/tinythread.inl
113-
d0cb958934e2d994b4802e0621f6a6b2 *man/RcppParallel-package.Rd
114-
ad93e519baac45a6520a29eb27a51655 *man/setThreadOptions.Rd
115-
5e0db2aa239803ec73cf24cf3286b9f4 *src/Makevars
116-
9c81a5c9f1c4acd843b6f03c1d883057 *src/Makevars.win
117-
8e9739bd16811d4c2e0a1a1958ee387b *src/options.cpp
115+
0c44e73699a42f681fe19e2c97d387b0 *inst/presentations/header.tex
116+
8e6bce8f0fa9f6145727aeafac626ae2 *inst/presentations/images/big-data-big-machine-tweet.png
117+
c2423aacc0fa4e2f520477749c96e7ad *inst/presentations/rcpp_parallel_talk_jan2015.Rmd
118+
86f28ba828e0ab4aed07deda77b62963 *inst/presentations/rcpp_parallel_talk_jan2015.pdf
119+
414995ebb0c43800f8ba9230cb8b1cf3 *inst/presentations/rcpp_parallel_talk_jan2015.tex
120+
a85e85238f06db0e654279fc6fa60427 *man/RcppParallel-package.Rd
121+
383a5f06b6ff0e8183c1779a6a8c499a *man/RcppParallelLibs.Rd
122+
f3b91a97f7f2c4cbe658b0858d74017e *man/setThreadOptions.Rd
123+
8b628cd39dbe1eab9dce8b8af98ba18b *src/Makevars
124+
13452c5ad3c85a5faae6483e9c4ca322 *src/options.cpp
118125
226aad3e6ae47bda6bea91202848216b *src/tbb/CHANGES
119126
2c7f2caf277a3933e3acdf7f89d54cc1 *src/tbb/COPYING
120127
8a9765106bf7a6501003abc3b5850cd0 *src/tbb/Makefile
@@ -140,7 +147,7 @@ cfb30ff17852c3a17d5dba8117128de6 *src/tbb/build/android.gcc.inc
140147
03f3bcd54852e81f493bcf1d1850a83f *src/tbb/build/big_iron.inc
141148
546a80649ae4e591754f4fa9f9e36a47 *src/tbb/build/codecov.txt
142149
33d32931b2f4b982ecf97455638b7a88 *src/tbb/build/common.inc
143-
76d9067a49f2f5426d8624d4206f9c24 *src/tbb/build/common_rules.inc
150+
11b78c96956d7f44749c7039329876fd *src/tbb/build/common_rules.inc
144151
64daf0f915722587c846bccde5ce291c *src/tbb/build/detect.js
145152
7bc0f0bf5d7f973ba16ccc0f2f637191 *src/tbb/build/generate_tbbvars.bat
146153
a94d41399b351b99a1a49c559cb90c31 *src/tbb/build/generate_tbbvars.sh
@@ -176,7 +183,7 @@ fe50a0837adfa4d28a4eb54330b5b89d *src/tbb/build/vs2010/index.html
176183
aeaa643fcb83517e92e762ed0b3b27fa *src/tbb/build/windows.cl.inc
177184
1749d820f760329bd1b76fcc6562cd40 *src/tbb/build/windows.gcc.inc
178185
56588cb3cca759312fad844b79846a95 *src/tbb/build/windows.icl.inc
179-
8ffe1bbfa32dd3c0c7f12a27636baa87 *src/tbb/build/windows.inc
186+
b1f30b0e803f45d9b264b89fd599d3e9 *src/tbb/build/windows.inc
180187
db4c2aeff8c80d7e311740d4aaefb8c8 *src/tbb/build/xbox360.cl.inc
181188
21969db22a32d041b47411282cd13bdf *src/tbb/build/xbox360.inc
182189
005136831e980c8640e9beee79f5f06c *src/tbb/include/index.html
@@ -608,3 +615,12 @@ c46281f7ecf8e5d5394e592cb4f1f800 *src/tbb/src/test/test_tbb_condition_variable.c
608615
0ff349ad76a2128c2fce42c636c5da0c *src/tbb/src/test/test_tuple.cpp
609616
3ee4ef65a4bcc4a569790a87eef01240 *src/tbb/src/test/test_write_once_node.cpp
610617
f547b9ff4294656aed8ec10f2949709f *src/tbb/src/test/test_yield.cpp
618+
00d073694ba5b403ea364b1374e388ba *tests/testthat.R
619+
c7e35f89b0b1ffb309920b6596b13d62 *tests/testthat/cpp/distance.cpp
620+
b9e5bbe1cadd17714288718fa225e49c *tests/testthat/cpp/innerproduct.cpp
621+
8ca3bc3f887c91b7dfd38ab0192b4bcc *tests/testthat/cpp/sum.cpp
622+
4b00b21da8acd051e50dd43e13f1f0c5 *tests/testthat/cpp/transform.cpp
623+
941d16c87e4e44ed3b4bfb57e4702feb *tests/testthat/test-distance.R
624+
e19798b9d3cdb2200cc9a301f8cb987b *tests/testthat/test-inner-product.R
625+
c29cc6c69613ad7024a42e7b7ec8eeab *tests/testthat/test-sum.R
626+
add17f30712bda0092f474c31c6a869d *tests/testthat/test-transform.R

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
export(setThreadOptions)
22
export(defaultNumThreads)
3+
export(RcppParallelLibs)
34

NEWS

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
RcppParallel 4.3.1
1+
RcppParallel 4.3.4
2+
------------------------------------------------------------------------
3+
4+
* Support for TBB on Windows
5+
6+
RcppParallel 4.3.3
27
------------------------------------------------------------------------
38

49
* Update to TBB 4.3 (fixes clang compilation error in platform.h)

R/build.R

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
2+
3+
# Output the LD flags for building against TBB. These flags are propagated
4+
# to sourceCpp via the inlineCxxPlugin (defined below) and to packages
5+
# via a line in Makevars.win like this:
6+
#
7+
# PKG_LIBS += $(shell "${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" -e "RcppParallel::LdFlags()")
8+
#
9+
# Note that this is only required for Windows builds (on Linux and OS X no
10+
# explicit link to TBB is required).
11+
RcppParallelLibs <- function() {
12+
cat(tbbLdFlags())
13+
}
14+
15+
16+
# Inline plugin used by sourceCpp to link to the TBB library
17+
inlineCxxPlugin <- function() {
18+
list(
19+
env = list(
20+
PKG_CXXFLAGS = "-DRCPP_PARALLEL_USE_TBB=1",
21+
PKG_LIBS = tbbLdFlags()
22+
),
23+
includes = "#include <RcppParallel.h>",
24+
LinkingTo = "RcppParallel",
25+
body = function( x ) x,
26+
Depends = "RcppParallel"
27+
)
28+
}
29+
30+
31+
# Return the linker flags requried for TBB on this platform
32+
tbbLdFlags <- function() {
33+
# on Windows we need to explicitly link against tbb.dll
34+
if (Sys.info()['sysname'] == "Windows") {
35+
tbb <- tbbLibPath()
36+
paste("-L", asBuildPath(dirname(tbb)), " -ltbb", sep="")
37+
} else {
38+
""
39+
}
40+
}
41+
42+
43+
# Determine the platform-specific path to the TBB library
44+
tbbLibPath <- function() {
45+
sysname <- Sys.info()['sysname']
46+
tbbSupported <- list(
47+
"Darwin" = "libtbb.dylib",
48+
"Linux" = "libtbb.so.2",
49+
"Windows" = "tbb.dll"
50+
)
51+
if (sysname %in% names(tbbSupported)) {
52+
libDir <- "lib/"
53+
if (sysname == "Windows")
54+
libDir <- paste(libDir, .Platform$r_arch, "/", sep="")
55+
system.file(paste(libDir, tbbSupported[[sysname]], sep = ""),
56+
package = "RcppParallel")
57+
} else {
58+
NULL
59+
}
60+
}
61+
62+
63+
# Helper function to ape the behavior of the R build system
64+
# when providing paths to libraries
65+
asBuildPath <- function(path) {
66+
if (.Platform$OS.type == "windows") {
67+
path <- normalizePath(path)
68+
if (grepl(' ', path, fixed=TRUE))
69+
path <- utils::shortPathName(path)
70+
path <- gsub("\\\\", "/", path)
71+
}
72+
return(path)
73+
}

R/hooks.R

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
dllInfo <- NULL
3+
4+
5+
.onLoad <- function(libname, pkgname) {
6+
7+
# load tbb on supported platforms
8+
tbb <- tbbLibPath()
9+
if (!is.null(tbb)) {
10+
if (!file.exists(tbb)) {
11+
warning(paste("TBB library", tbb, "not found."))
12+
} else {
13+
dllInfo <<- dyn.load(tbb, local = FALSE, now = TRUE)
14+
}
15+
}
16+
17+
# load the package library
18+
library.dynam("RcppParallel", pkgname, libname)
19+
20+
# set default thread options
21+
setThreadOptions()
22+
}
23+
24+
.onUnload <- function(libpath) {
25+
26+
# unload the package library
27+
library.dynam.unload("RcppParallel", libpath)
28+
29+
# unload tbb if we loaded it
30+
if (!is.null(dllInfo))
31+
dyn.unload(dllInfo[["path"]])
32+
}

R/options.R

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,5 @@
11

22

3-
dllInfo <- NULL
4-
5-
.onLoad <- function(libname, pkgname) {
6-
7-
# load tbb if we aren't on windows
8-
sysname <- Sys.info()['sysname']
9-
if (sysname %in% c("Linux", "Darwin")) {
10-
if (sysname == "Darwin")
11-
ext = ".dylib"
12-
else if (sysname == "Linux")
13-
ext = ".so.2"
14-
dll <- system.file(paste("lib/libtbb", ext, sep = ""), package = "RcppParallel")
15-
dllInfo <<- dyn.load(dll, local = FALSE, now = TRUE)
16-
}
17-
18-
# load the package library
19-
library.dynam("RcppParallel", pkgname, libname)
20-
21-
# set default thread options
22-
setThreadOptions()
23-
}
24-
25-
.onUnload <- function(libpath) {
26-
27-
# unload the package library
28-
library.dynam.unload("RcppParallel", libpath)
29-
30-
# unload tbb if we loaded it (i.e. aren't on windows)
31-
if (!is.null(dllInfo))
32-
dyn.unload(dllInfo[["path"]])
33-
}
34-
353
setThreadOptions <- function(numThreads = "auto", stackSize = "auto") {
364

375
# validate and resolve numThreads
@@ -50,7 +18,8 @@ setThreadOptions <- function(numThreads = "auto", stackSize = "auto") {
5018
else
5119
stackSize <- as.integer(stackSize)
5220

53-
if (Sys.info()['sysname'] %in% c("Linux", "Darwin")) {
21+
# Call setThreadOptions if using tbb
22+
if (!is.null(dllInfo)) {
5423
invisible(.Call("setThreadOptions", numThreads, stackSize,
5524
PACKAGE = "RcppParallel"))
5625
}

README.md

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,9 @@
22

33
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.
44

5-
The high level interface enables safe and robust parallel programming without direct manipulation of operating system threads. The underlying implementation differs by platform: on Linux and Mac systems the [Intel TBB](https://www.threadingbuildingblocks.org/) (Threading Building Blocks) are used while on Windows systems the [TinyThread](http://tinythreadpp.bitsnbites.eu/) library is used.
5+
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](https://www.threadingbuildingblocks.org/) (Threading Building Blocks). On other platforms a less-performant fallback implementation based on the [TinyThread](http://tinythreadpp.bitsnbites.eu/) library is used.
66

7-
### Examples
8-
9-
Here are links to some examples that illustrate using RcppParallel. Performance benchmarks were executed on a 2.6GHz Haswell MacBook Pro with 4 cores (8 with hyperthreading).
10-
11-
[Parallel Matrix Transform](http://gallery.rcpp.org/articles/parallel-matrix-transform/) --- Demonstrates using `parallelFor` to transform a matrix (take the square root of each element) in parallel. In this example the parallel version performs about 2.5x faster than the serial version.
12-
13-
[Parallel Vector Sum](http://gallery.rcpp.org/articles/parallel-vector-sum/) --- Demonstrates using `parallelReduce` to take the sum of a vector in parallel. In this example the parallel version performs 4.5x faster than the serial version.
14-
15-
[Parallel Distance Matrix](http://gallery.rcpp.org/articles/parallel-distance-matrix/) --- Demonstrates using `parallelFor` to compute pairwise distances for each row in an input data matrix. In this example the parallel version performs 5.5x faster than the serial version.
16-
17-
[Parallel Inner Product](http://gallery.rcpp.org/articles/parallel-inner-product/) --- Demonstrates using `parallelReduce` to compute the inner product of two vectors in parallel. In this example the parallel version performs 2.5x faster than the serial version.
18-
19-
Note that the benchmark times above are for the TBB back-end (Posix systems only). Performance on Windows will be about 30-50% slower as a result of less sophisticated thread scheduling.
20-
21-
### Usage
22-
23-
You can install the RcppParallel package from CRAN as follows:
24-
25-
```s
26-
install.packages("RcppParallel")
27-
```
28-
29-
#### sourceCpp
30-
31-
You can use the RcppParallel library from within a standalone C++ source file as follows:
32-
33-
```cpp
34-
// [[Rcpp::depends(RcppParallel)]]
35-
#include <RcppParallel.h>
36-
```
37-
38-
#### Packages
39-
40-
If you want to use RcppParallel from within an R package you add the following to your DESCRIPTION file:
41-
42-
```yaml
43-
Imports: RcppParallel
44-
LinkingTo: RcppParallel
45-
```
46-
47-
And the following to your NAMESPACE file:
48-
49-
```s
50-
import(RcppParallel)
51-
```
7+
For additional documentation on using RcppParallel see the package website at http://rcppcore.github.io/RcppParallel/.
528

539
### License
5410

inst/include/RcppParallel.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,20 @@
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
1013
#if defined(__APPLE__) || defined(__gnu_linux__)
11-
#define RCPP_PARALLEL_USE_TBB 1
12-
#include "RcppParallel/TBB.h"
14+
#define RCPP_PARALLEL_USE_TBB 1
15+
#include "RcppParallel/TBB.h"
1316
#else
14-
#define RCPP_PARALLEL_USE_TBB 0
17+
#define RCPP_PARALLEL_USE_TBB 0
18+
#endif
1519
#endif
20+
21+
#if RCPP_PARALLEL_USE_TBB
22+
#include "RcppParallel/TBB.h"
1623
#endif
1724

1825
#include "RcppParallel/RVector.h"

inst/presentations/header.tex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
\definecolor{links}{HTML}{2A1B81}
3+
\hypersetup{colorlinks,linkcolor=,urlcolor=links}
4+
5+
\AtBeginSection[] {
6+
\begin{frame}
7+
\frametitle{Outline}
8+
\tableofcontents[currentsection,hideallsubsections]%
9+
\end{frame}
10+
}

0 commit comments

Comments
 (0)