[R-pkg-devel] Compile issues on r-devel-linux-x86_64-debian-clang with OpenMP

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Mon May 27 00:57:17 CEST 2024


On 26 May 2024 at 13:31, Kurt Hornik wrote:
| >>>>> Dirk Eddelbuettel writes:
| 
| > Kurt,
| 
| > Could you do me a favour and run on that clang18-using machine in question
| > the following one-liner (provided your session has access to a .libPaths()
| > including Rcpp) and, in the case of success, the resulting function?
| 
| I can: 
| 
| R> Rcpp::cppFunction("int ompconfigtest() { return omp_get_num_threads(); }", includes="#include <omp.h>", plugin="openmp")
| Warning in Rcpp::cppFunction("int ompconfigtest() { return omp_get_num_threads(); }",  :
|   partial argument match of 'plugin' to 'plugins'
| R>  ompconfigtest()
| [1] 1

Hmpf.

| The system has OpenMP, but R was configured not to use it.

Again, it would be lovely if we could _query_ that.

| In general, packages should leave the decision to use OpenMP to the
| *user*, who can use their own Makevars files to override the R system
| Makevars SHLIB_OPENMP_* settings as desired.

Didn't help here, did it?  Or maybe Rcpp was too eager with 

   .plugins[["openmp"]] <- function() {
       list(env = list(PKG_CXXFLAGS="-fopenmp",
                       PKG_LIBS="-fopenmp"))
   }

and we'd need something like this (untested)

   .plugins[["openmp"]] <- function() {
       list(env = list(PKG_CXXFLAGS=Sys.getenv("SHLIB_OPENMP_CXXFLAGS, ""),
                       PKG_LIBS=Sys.getenv("SHLIB_OPENMP_CXXFLAGS, "")))
   }

Actually, does not work it does come into the R session. Only goes to `make`.

So I got nothing. Sorry.

Dirk

-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list