Comments (10)
I think it would be better to be contained within armadillo. I noodled around with the Makevars
approach I outlined above. It didn't work out well since I do not believe Makevars
is even used by R/Attributes.R
after browsing the file.
So, I would propose an approach similar to RQuantlib
for setting the flag.
inlineCxxPlugin <- function(...) {
plugin <- Rcpp:::Rcpp.plugin.maker(include.before = "#include <RcppArmadillo.h>",
libs = "$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS)",
package = "RcppArmadillo")
settings <- plugin()
settings$env$PKG_CPPFLAGS <- paste0("$(SHLIB_OPENMP_CXXFLAGS)")
settings
}
from rcpparmadillo.
But ... as I recall this gist of getting OpenMP was to both compile and link with -fopenmp
so we would need to get it into CXXFLAGS
, or PKG_CXXFLAGS
, or ... And make sure we cover the various C++ dialect options we now have.
from rcpparmadillo.
Ie here is what Rcpp does in its plugin for openmp:
## built-in OpenMP++11 plugin
.plugins[["openmp"]] <- function() {
list(env = list(PKG_CXXFLAGS="-fopenmp",
PKG_LIBS="-fopenmp"))
}
(I suppose OpenMP++11 is a cut-and-pasto. Should be OpenMP.)
from rcpparmadillo.
@eddelbuettel You are correct. The functionality of Rcpp.plugin.maker
needs to be extended...
from rcpparmadillo.
Or, what can happen is an injection into the Makevars
slot in a similar way as the libs
line is defined. See R/inline.R#L44-L54
Rcpp:::Rcpp.plugin.maker(
include.before = "#include <RcppArmadillo.h>",
libs = "$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CFLAGS)",
Makevars = list( PKG_CXXFLAGS = "$(SHLIB_OPENMP_CXXFLAGS)" ) ,
Makevars.win = list( PKG_CXXFLAGS = "$(SHLIB_OPENMP_CXXFLAGS)" ),
package = "RcppArmadillo")
from rcpparmadillo.
Or ... we just punt and tell folks to rely on the existing plugin for OpenMP which reliably turns on OpenMP?
Ie recommend to turn on RcppArmadillo (via Rcpp::depends()
) and OpenMP (via Rcpp::plugins()
) ?
from rcpparmadillo.
RcppGSL does something similar. The crux, as you say, is that this once aimed the inline package, and Rcpp sort of just picked it up.
We have to figure put the different use case and try to make sure we hit most of them home...
from rcpparmadillo.
Per 70a27b7 and 150899f this can be closed out.
However, note that Makevars
uses PKG_CXXFLAGS
while Makevars.win
uses PKG_CPPFLAGS
.
Though, setting the flags through either appears to matriculate the correct flags for the compile.
from rcpparmadillo.
Yes, testing this on Metra this am. Seems to work. Users may still have to supply the C++11 or C++14 (Rcpp) plugin in addition to the the depends getting them this from the pluginMaker.
Thanks for the reminder on the Makevars. I'll clean this up. Writing R Extension is a little rambling there but I PKG_CXXFLAGS may be better.
One thought I had was to ... maybe adding comments that all this is optional may help? Then again adding -fopenmp without actual OpenMP directive is just a null-op so no harm done.
from rcpparmadillo.
I think this one can be closed now.
from rcpparmadillo.
Related Issues (20)
- warning: chol(): given matrix is not symmetric HOT 7
- Possible bug in configure.ac HOT 18
- Problems in installing RcppArmadillo on macOS Monterey HOT 3
- Missing distr_param argument in randu HOT 8
- no matching function for call to βarma::Cube<double>::insert_slices(arma::uword&, arma::mat&) HOT 2
- Deprecating old initialization code in packages using RcppArmadillo HOT 17
- Is `ARMA_64BIT_WORD` supported in RcppArmadillo? HOT 4
- NaN output from arma::uvec compared to arma::vec HOT 4
- Planning to potentially (re)move some legacy internal header files
- Deprecating old stderr stream setting code in packages using RcppArmadillo HOT 12
- Fails to compile vs HOT 3
- Question about SIMD Optimization HOT 3
- package compilation failure HOT 20
- Two failures in test_cube.R on PowerPC HOT 33
- Armadillo 12.0.0 regressions HOT 2
- `RCPP_ARMADILLO_RETURN_ANYVEC_AS_VECTOR` in an R package? HOT 2
- using namespace arma; HOT 1
- Issue on call by reference with a NA matrix HOT 1
- Update indMatrix->arma::SpMat and pMatrix->arma::SpMat for Matrix 1.5-5 HOT 2
- install issue HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rcpparmadillo.