Skip to content

Commit 7f66a3b

Browse files
committed
set '-mtune' flags; add 'BH' LinkingTo dependency
1 parent e31ec98 commit 7f66a3b

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

R/build.R

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,25 @@ RcppParallelLibs <- function() {
1717
inlineCxxPlugin <- function() {
1818
list(
1919
env = list(
20-
PKG_CXXFLAGS = tbbCxxFlags(),
20+
PKG_CXXFLAGS = paste(tbbCxxFlags(), mtuneFlags()),
2121
PKG_LIBS = tbbLdFlags()
2222
),
2323
includes = "#include <RcppParallel.h>",
24-
LinkingTo = "RcppParallel",
25-
body = function( x ) x,
24+
LinkingTo = c("RcppParallel", "BH"),
25+
body = function(x) x,
2626
Depends = "RcppParallel"
2727
)
2828
}
2929

30+
mtuneFlags <- function() {
31+
switch(Sys.info()[["sysname"]],
32+
"Linux" = "-mtune=native",
33+
"Darwin" = "-mtune=core2",
34+
"Windows" = "-mtune=core2",
35+
""
36+
)
37+
}
38+
3039
tbbCxxFlags <- function() {
3140
flags <- "$(CXX1XSTD)"
3241
if (Sys.info()['sysname'] == "Windows")

vignettes/simd-operations.Rmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Here's a quick example of how we might compute the sum of elements in a vector,
1717

1818
```{r, engine='Rcpp'}
1919
// [[Rcpp::depends(RcppParallel)]]
20-
#include <RcppParallel.h>
20+
#include <RcppParallelSIMD.h>
2121
#include <Rcpp.h>
2222
2323
using namespace RcppParallel;
@@ -59,7 +59,7 @@ These functions operate like their `std::` counterparts, but expect a functor wi
5959

6060
```{r, engine='Rcpp'}
6161
// [[Rcpp::depends(RcppParallel)]]
62-
#include <RcppParallel.h>
62+
#include <RcppParallelSIMD.h>
6363
#include <Rcpp.h>
6464
6565
#include <boost/simd/arithmetic/functions/min.hpp>

0 commit comments

Comments
 (0)