You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -62,48 +64,65 @@ if (requireNamespace("microbenchmark", quietly = TRUE)) {
62
64
63
65
## SIMD Algorithms
64
66
65
-
Boost.SIMD provides two primary abstractions for the implementation of SIMD algorithms:
67
+
`Boost.SIMD` provides two primary abstractions for the
68
+
implementation of SIMD algorithms:
66
69
67
70
-`simd::accumulate()`, for vector -> scalar transformations, and
68
71
-`simd::transform()`, for vector -> vector transformations.
69
72
70
-
These functions operate like their `std::` counterparts, but expect a functor with a templated call operator. By making the call operator templated, `Boost.SIMD` can generate code using its own optimized SIMD functions when appropriate, and fall back to a default implementation (based on the types provided) when not.
73
+
These functions operate like their `std::` counterparts, but
74
+
expect a functor with a templated call operator. By making
75
+
the call operator templated, `Boost.SIMD` can generate code
76
+
using its own optimized SIMD functions when appropriate, and
77
+
fall back to a default implementation (based on the types
78
+
provided) when not.
71
79
72
80
## Using SIMD in an R Package
73
81
74
-
To build an R package that uses Boost.SIMD you need to make some modifications to the standard RcppParallel configuration:
75
-
76
-
1. Add the **BH** package as a LinkingTo dependency
77
-
2. Add C++11 as a SystemRequirement
82
+
To build an R package that uses `Boost.SIMD`, you need to
83
+
make some modifications to the standard RcppParallel
84
+
configuration. Within the `DESCRIPTION` file of your package,
85
+
you need to:
78
86
87
+
1. Add the **BH** package as a `LinkingTo` dependency, and
88
+
2. Add `C++11` as a `SystemRequirement`
79
89
80
90
### Platform Compatibility
81
91
82
-
Note that Boost.SIMD requires a C++11 conformant compiler. This means that packages making use of SIMD features may not compile on platforms with older compilers including Windows and RedHat/CentOS Linux. You can however create a package that takes advantage of Boost.SIMD where available and falls back to a non-SIMD implementation elsewhere.
83
-
84
-
You can test for the availability of Boost.SIMD on a given platform using the `RCPP_PARALLEL_USE_SIMD` preprocessor variable. If the current compiler doesn't support C++11 (as determined by `__cplusplus <= 199711L`) the variable will be undefined (even if you defined it explicitly). This allows you to write code like this:
92
+
`Boost.SIMD` requires a C++11 conformant compiler. This
93
+
means that packages making use of SIMD features may not
94
+
compile on platforms with older compilers, including Windows
95
+
and RedHat/CentOS Linux. You can however create a package
96
+
that takes advantage of `Boost.SIMD` where available and falls
97
+
back to a non-SIMD implementation otherwise.
98
+
99
+
You can opt-in to the use of `Boost.SIMD` by defining the
100
+
`RCPP_PARALLEL_USE_SIMD` macro before including
101
+
`<RcppParallel.h>`, e.g.
102
+
103
+
#define RCPP_PARALLEL_USE_SIMD
104
+
105
+
You can test for the availability of `Boost.SIMD` on a given
106
+
platform using the `RCPP_PARALLEL_USE_SIMD` preprocessor
107
+
variable. If the current compiler doesn't support C++11 (as
108
+
determined by `__cplusplus <= 199711L`) the variable will be
109
+
undefined (even if you defined it explicitly). This allows
The two `transformDataImpl` functions have the same name, but only one will be compiled and linked based on whether the target platform supports Boost.SIMD.
137
+
The two `transformDataImpl` functions have the same name,
138
+
but only one will be compiled and linked based on whether
139
+
the target platform supports `Boost.SIMD`.
119
140
120
-
Note that if you conditionally compile all uses of Boost.SIMD within your package then you can actually drop the `C++11` from `SystemRequirements` (it's no longer required as a result of your fallback implementation).
141
+
Note that if you conditionally compile all uses of
142
+
`Boost.SIMD` within your package, then you can drop
143
+
the `C++11` from `SystemRequirements` (it's no longer
144
+
required as a result of your fallback implementation).
0 commit comments