Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Note on OpenMP & Rcpp Plugin #2

Open
coatless opened this issue Feb 6, 2023 · 2 comments
Open

Note on OpenMP & Rcpp Plugin #2

coatless opened this issue Feb 6, 2023 · 2 comments

Comments

@coatless
Copy link

coatless commented Feb 6, 2023

Nino,

Hope all is well. Glancing at the updated package, I think everything should now be in order for your CRAN submission.

That is, you are using an #ifdef _OPENMP to protect against including OpenMP headers ( <omp.h> ) if they are absent from the crippled compiler inside a custom myomp.h

#ifdef _OPENMP

However, the next line down, you are including:

// [[Rcpp::plugins(openmp)

This plugin only works with the standalone Rcpp functions (evalCpp(), cppFunction(), and sourceCpp()). Within a package context, it isn't setting any variables required. You can remove this line as a result.

The true compiler flags for OpenMP are being set in src/Makevars:

echoice2/src/Makevars

Lines 2 to 3 in 114108d

PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)

In particular, note that SHLIB_OPENMP_CXXFLAGS appears twice over.

@ninohardt
Copy link
Owner

James,

thank you! I removed // [[Rcpp::plugins(openmp).
It's unfortunate that MacOS users need to invest so much effort to install and recompile the package to benefit from OpenMP support, but at least it runs.

@coatless
Copy link
Author

coatless commented Mar 4, 2023

@ninohardt we're slowly moving toward adding the omp.h headers into the new "Mac for Rtools" approach.

https://github.com/coatless-mac/macrtools

Right now, your users should be able to get Xcode CLI, gfortran, and an assortment of R development binaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants