-
Notifications
You must be signed in to change notification settings - Fork 56
Further macOS OpenMP tweaks #497
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
Changes from 4 commits
edcb6fb
99e405d
4c85a92
e113120
87508e8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||
| ## Copyright (C) 2010 - 2024 Dirk Eddelbuettel, Romain Francois and Douglas Bates | ||||||
| ## Copyright (C) 2010 - 2025 Dirk Eddelbuettel, Romain Francois and Douglas Bates | ||||||
| ## | ||||||
| ## This file is part of RcppArmadillo. | ||||||
| ## | ||||||
|
|
@@ -16,8 +16,7 @@ | |||||
| ## along with RcppArmadillo. If not, see <http://www.gnu.org/licenses/>. | ||||||
|
|
||||||
| inlineCxxPlugin <- function(...) { | ||||||
| ismacos <- Sys.info()[["sysname"]] == "Darwin" | ||||||
| openmpflag <- if (ismacos) "" else "$(SHLIB_OPENMP_CFLAGS)" | ||||||
| openmpflag <- "$(SHLIB_OPENMP_CFLAGS)" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does not matter in practice. There are three, they are always identical (?) and CRAN only complains if you use different ones between compiler and linker. I have long used the C variant for simplicity (though also probably not always). edd@paul:~$ grep SHLIB_OPENMP_ /etc/R/Makeconf
SHLIB_OPENMP_CFLAGS = -fopenmp
SHLIB_OPENMP_CXXFLAGS = -fopenmp
SHLIB_OPENMP_FFLAGS = -fopenmp
edd@paul:~$ |
||||||
| plugin <- Rcpp::Rcpp.plugin.maker(include.before = "#include <RcppArmadillo.h>", | ||||||
| libs = paste(openmpflag, "$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)"), | ||||||
| package = "RcppArmadillo") | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,8 @@ | ||
|
|
||
| // RcppArmadilloGenerated.h: Autoconf-updated file for LAPACK and OpenMP choices | ||
| // RcppArmadilloConfigGenerated.h: Autoconf-updated file for LAPACK and OpenMP choices | ||
| // | ||
| // Copyright (C) 2013 - 2021 Dirk Eddelbuettel | ||
| // Copyright (C) 2013 - 2025 Dirk Eddelbuettel | ||
| // 2025 James J. Balamuta | ||
| // | ||
| // This file is part of RcppArmadillo. | ||
| // | ||
|
|
@@ -21,9 +22,19 @@ | |
| #ifndef RcppArmadillo__RcppArmadilloConfigGenerated__h | ||
| #define RcppArmadillo__RcppArmadilloConfigGenerated__h | ||
|
|
||
| #ifndef ARMA_USE_OPENMP | ||
| // from configure test for OpenMP based on how R is configured, and whether g++ new enough | ||
| @ARMA_HAVE_OPENMP@ | ||
| // macOS special case as discussed in https://github.com/RcppCore/RcppArmadillo/issues/493 | ||
| #if !defined(ARMA_USE_OPENMP) | ||
| #if defined(__APPLE__) && defined(_OPENMP) | ||
| // User has OpenMP available, but check if they want it disabled | ||
| #ifndef RCPPARMA_MACOS_DISABLE_OPENMP | ||
eddelbuettel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| #define ARMA_USE_OPENMP 1 | ||
| #else | ||
| #define ARMA_DONT_USE_OPENMP 1 | ||
| #endif | ||
| #else | ||
| // from configure test for OpenMP based on how R is configured | ||
| @ARMA_HAVE_OPENMP@ | ||
| #endif | ||
| #endif | ||
|
|
||
| #endif | ||
Uh oh!
There was an error while loading. Please reload this page.