Skip to content

procedure to ship libomp.dylib run-time with package

1 message · Balamuta, James Joseph

#
Simon,

Thanks for the update. I?m aware of the linking instructions [1,2,3,4] and the purpose of configure{.ac} [5]. What I was not aware of was the CRAN macOS build machine were outfitted with the appropriate OpenMP setup [6, 7] in a post R 4.0.0 world. Thus, more than just local configurations that adopted [8] could benefit from OpenMP especially since the top of [8] contains:
Changing focus, I?m interested in re-enabling OpenMP with respect to RcppArmadillo, my questions here are:


  1.  When did libomp.dylib start shipping with the CRAN build? R 4.1, 4.2, 4.3, or 4.4?
     *   This will allow me to petition to have an R version dependency change.
  2.  If a package only needs to compile code only once, then it?s sufficient to use the usual ` $(SHLIB_OPENMP_CXXFLAGS)` in src/Makevars with the appropriate ifdef pre-processor on including #include <omp.h>?
     *   This provides improved guidance related to best package development practices.
  3.  For packages that compile code first on CRAN and, then, dynamically on a user?s computer, what is the best approach to ensuring that instructions in [8] are set?
     *   This would ensure armadillo-oriented code could take full use of the cores on macOS.

Best regards,

James

[1]: https://stat.ethz.ch/pipermail/r-sig-mac/2020-April/013346.html
[2]: https://stat.ethz.ch/pipermail/r-sig-mac/2019-May/012987.html
[3]: https://stat.ethz.ch/pipermail/r-sig-mac/2019-June/012996.html
[4]: https://stat.ethz.ch/pipermail/r-sig-mac/2020-May/013451.html
[5]: https://stackoverflow.com/a/42281495/1345455
[6]: https://github.com/RcppCore/RcppArmadillo/pull/219#issuecomment-383100722
[7]: https://stat.ethz.ch/pipermail/r-sig-mac/2020-April/013289.html
[8]: https://mac.r-project.org/openmp/



From: Simon Urbanek <simon.urbanek at R-project.org>
Date: Friday, June 28, 2024 at 12:31?AM
To: Balamuta, James <balamut2 at illinois.edu>
Cc: Timothy Bates <tim.bates at ed.ac.uk>, Kasper Daniel Hansen <kasperdanielhansen at gmail.com>, Sparapani, Rodney <rsparapa at mcw.edu>, R list <R-SIG-Mac at r-project.org>
Subject: Re: [R-SIG-Mac] procedure to ship libomp.dylib run-time with package
That's entirely unnecessary - you should not be requiring specific file paths - that's not how linking tests work. All the instructions are on the OpenMP page for years - it is as simple as -lomp (which is standard almost everywhere). The only non-standard requirement compared to other platforms is that instead of -fopemp in C flags the package should also check for -Xclang -fopenmp.

If a package explicitly disables OpenMP for Apple compilers, it is its deliberate choice - it was never necessary. The whole point of configure scripts is to detect functionality by testing it and use it if available.

Cheers,
Simon