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

Kurt Hornik Kurt@Horn|k @end|ng |rom wu@@c@@t
Sun May 26 13:31:29 CEST 2024


>>>>> 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

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

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.  

Best
-k


>> Rcpp::cppFunction("int ompconfigtest() { return omp_get_num_threads(); }", includes="#include <omp.h>", plugin="openmp")
>> ompconfigtest()
>   [1] 1
>> 

> On a "normal" development machine such as mine here it works.

> Presumably it will fail at your end because -fopenmp will not be / cannot be
> substituted in from the openmp plugin defined by Rcpp:

>   ## built-in OpenMP plugin
>   .plugins[["openmp"]] <- function() {
>       list(env = list(PKG_CXXFLAGS="-fopenmp",
>                       PKG_LIBS="-fopenmp"))
>   }

> but it would be nice to know if that does indeed fail.

> Thanks,  Dirk

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



More information about the R-package-devel mailing list