Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2025-11-13 Dirk Eddelbuettel <edd@debian.org>

* R/inline.R (inlineCxxPlugin): No longer special-case macOS for
OpenMP but rely on "$(SHLIB_OPENMP_CFLAGS)" as everywhere else

* inst/include/RcppArmadillo/config/RcppArmadilloConfigGenerated.h.in:
Refine macOS OpenMP detection, respect RCPPARMA_MACOS_DISABLE_OPENMP

* inst/include/RcppArmadillo/config/RcppArmadilloConfig.h:
ARMA_CRIPPLED_LAPACK is only defined if 'LEGACY' Armadillo selected

2025-11-04 Dirk Eddelbuettel <edd@debian.org>

* README.md: Minor edits
Expand Down
5 changes: 2 additions & 3 deletions R/inline.R
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.
##
Expand All @@ -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)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be SHLIB_OPENMP_CXXFLAGS instead?

Suggested change
openmpflag <- "$(SHLIB_OPENMP_CFLAGS)"
openmpflag <- "$(SHLIB_OPENMP_CXXFLAGS)"

Copy link
Member Author

Choose a reason for hiding this comment

The 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")
Expand Down
13 changes: 9 additions & 4 deletions inst/include/RcppArmadillo/config/RcppArmadilloConfig.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

// RcppArmadilloConfig.h: Rcpp/Armadillo glue
//
// Copyright (C) 2010 - 2022 Dirk Eddelbuettel, Romain Francois and Douglas Bates
// Copyright (C) 2016 - 2022 George G. Vega Yon
// Copyright (C) 2017 - 2022 Serguei Sokol
// Copyright (C) 2010 - 2025 Dirk Eddelbuettel, Romain Francois and Douglas Bates
// Copyright (C) 2016 - 2025 George G. Vega Yon
// Copyright (C) 2017 - 2025 Serguei Sokol
//
// This file is part of RcppArmadillo.
//
Expand Down Expand Up @@ -99,7 +99,12 @@
// R can be built with its own Rlapack library, or use an external
// one. Only the latter has zgesdd, a complex-valued SVD using divide-and-conquer
// on Windows we do not assume ZGESDD
#define ARMA_CRIPPLED_LAPACK 1
//
// Update 2025-Nov: R now generally has good enough LAPACK/BLAS, and newer Arma
// versions whine so protecting this now for use with Armadillo older than 15.*
#if defined(ARMA_SELECTED_LEGACY_VERSION)
#define ARMA_CRIPPLED_LAPACK 1
#endif
// on Windows we can now assume OpenMP with Rtools / gcc 4.9.3
// note that performance is said to still be poor
// cf https://cran.r-project.org/doc/manuals/r-devel/R-admin.html#The-MinGW_002dw64-toolchain
Expand Down
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.
//
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the standard prefix RCPPARMA? Or should we go RCPPARMADILLO ?

Copy link
Member Author

@eddelbuettel eddelbuettel Nov 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Both better and more consistent. Will switch to long form.

(I think I followed your suggestion letter by letter though 😜 )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eddelbuettel I know. I couldn't remember what was settled on for the prefix though post legacy/current defines.

#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