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

2024-05-26 Thread Dirk Eddelbuettel


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 ", 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 | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel


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

2024-05-26 Thread Kurt Hornik
> 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 ", 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 ", 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 | e...@debian.org

__
R-package-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel