[R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)
kev|nu@hey @end|ng |rom gm@||@com
Sat Apr 25 18:08:26 CEST 2020
The following works for me on macOS 10.15.4 using Apple Clang + libomp
from LLVM 10 (via Homebrew).
Install libomp from Homebrew with:
brew install libomp
Then, put the following in ~/.R/Makevars
CPPFLAGS += -I/usr/local/opt/libomp/include -Xclang -fopenmp
LDFLAGS += -L/usr/local/opt/libomp/lib -lomp
Then R will automatically enable + use OpenMP as appropriate when
installing packages from sources.
The main danger of this approach, as I understand it, is that there's
no guarantee that this will work properly (or continue to work
properly) as the Apple toolchain continues to be updated -- e.g. a new
version of macOS / Xcode could install a version of Apple Clang that
is then incompatible with the version of libomp currently in use. In
such a case, I suspect one would need to find and reinstall libomp.
In theory, this could be alleviated by ensuring all users download and
use the same version of Xcode as is being used by the macOS build
machine (Xcode 10.1), but in practice users will likely just be using
the "default" set of command line tools that comes with their version
Cunningham's law will hopefully ensure someone else will chime in if
I've got something wrong :-)
On Sat, Apr 25, 2020 at 8:29 AM Wright, Erik Scott <ESWRIGHT using pitt.edu> wrote:
> I second this request. Dropping OpenMP support in R v4.0 on Mac is unfortunate. My R package is highly parallelized via OpenMP, and many of my end-users take advantage of the excellent speedups. It would be much appreciated if user-level instructions could be provided for how to enable OpenMP support on the Mac.
> > On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <selivanov.dmitriy using gmail.com> wrote:
> > Hi Simon,
> > Just wanted follow up on this topic.
> > It would be very helpful if you can provide some guide on
> > https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&reserved=0 <https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&reserved=0> for those users
> > (advanced?) and developers who wants to be able to use OpenMP on mac. From
> > what I've understood from this mail thread the easiest way is to install R
> > from homebrew as it is built with non-standard Apple toolchain.
> > Apart from that you've mentioned you may consider to bundle binary iomp
> > with R installation, but "it would be on the package author to make sure
> > that the way the package operates is compatible with that binary". Could
> > you please elaborate on that?
> > I believe I'm not alone who would like to be able to use OpenMP on mac and
> > "official" guidance would be very helpful.
> > --
> > Regards
> > Dmitriy Selivanov
> > [[alternative HTML version deleted]]
> > _______________________________________________
> > R-SIG-Mac mailing list
> > R-SIG-Mac using r-project.org
> > https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&reserved=0
> R-SIG-Mac mailing list
> R-SIG-Mac using r-project.org
More information about the R-SIG-Mac