Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Dmitriy Selivanov
Hi Simon,

Just wanted follow up on this topic.

It would be very helpful if you can provide some guide on
https://mac.R-project.org <https://mac.r-project.org/> 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
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Wright, Erik Scott
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.

Thanks,
Erik


> On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <[hidden email]> 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&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&amp;sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&amp;reserved=0 <https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&amp;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
> [hidden email]
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&amp;reserved=0

_______________________________________________
R-SIG-Mac mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Kevin Ushey
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
of macOS.

Cunningham's law will hopefully ensure someone else will chime in if
I've got something wrong :-)

Best,
Kevin

On Sat, Apr 25, 2020 at 8:29 AM Wright, Erik Scott <[hidden email]> 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.
>
> Thanks,
> Erik
>
>
> > On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <[hidden email]> 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&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&amp;sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&amp;reserved=0 <https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&amp;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
> > [hidden email]
> > https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&amp;reserved=0
>
> _______________________________________________
> R-SIG-Mac mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

_______________________________________________
R-SIG-Mac mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Dmitriy Selivanov
Thanks, Kevin, I can confirm suggested setup works fine so far. Thank you!

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.


Thats understandable.

On Sat, Apr 25, 2020 at 8:09 PM Kevin Ushey <[hidden email]> wrote:

> 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
> of macOS.
>
> Cunningham's law will hopefully ensure someone else will chime in if
> I've got something wrong :-)
>
> Best,
> Kevin
>
> On Sat, Apr 25, 2020 at 8:29 AM Wright, Erik Scott <[hidden email]>
> 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.
> >
> > Thanks,
> > Erik
> >
> >
> > > On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <
> [hidden email]> 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&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&amp;sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&amp;reserved=0
> <
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&amp;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
> > > [hidden email]
> > >
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&amp;reserved=0
> >
> > _______________________________________________
> > R-SIG-Mac mailing list
> > [hidden email]
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>


--
Regards
Dmitriy Selivanov

        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-Mac mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Wright, Erik Scott
Hi Kevin et al.,

The setup you suggested did not work for me, but I was able to get OpenMP to work on Mac (10.13) with R v4.0 packages.  Here's what I did:

(1) After installing Homebrew, ran
brew install libomp
# Note it is also possible to install from OpenMP Source code: https://releases.llvm.org/download.html#10.0.0
(2) Determined the install path with
brew --prefix libomp
# In my case /usr/local/opt/libomp
(3) Added lines to ~/.R/Makevars
CC=/usr/local/clang4/bin/clang -fopenmp -I/usr/local/opt/libomp/include
LDFLAGS=-L/usr/local/opt/libomp/lib

I imagine the process is similar for C++ code by setting CXX.  Now parallelization for C code with OpenMP is working again on Mac.

As always, I am thankful to the R community for helping problem solve.

I wish more direction along these lines could be added to mac.r-project.org<http://mac.r-project.org>

Erik


On Apr 29, 2020, at 1:51 AM, Dmitriy Selivanov <[hidden email]<mailto:[hidden email]>> wrote:

Thanks, Kevin, I can confirm suggested setup works fine so far. Thank you!

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.

Thats understandable.

On Sat, Apr 25, 2020 at 8:09 PM Kevin Ushey <[hidden email]<mailto:[hidden email]>> wrote:
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
of macOS.

Cunningham's law will hopefully ensure someone else will chime in if
I've got something wrong :-)

Best,
Kevin

On Sat, Apr 25, 2020 at 8:29 AM Wright, Erik Scott <[hidden email]<mailto:[hidden email]>> 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.
>
> Thanks,
> Erik
>
>
> > On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <[hidden email]<mailto:[hidden email]>> 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&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&amp;sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&amp;reserved=0<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&data=02%7C01%7CESWRIGHT%40pitt.edu%7C97942eff1d0444324e2008d7ec016278%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637237363009843423&sdata=mFd6228vyjEBn7K5yVMwxyHVZePFOQWXMuSh0nqmXbE%3D&reserved=0><https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&amp;reserved=0<<a href="https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&data=02%7C01%">https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&data=02%7C01%
 7CESWRIGHT%40pitt.edu%7C97942eff1d0444324e2008d7ec016278%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637237363009843423&sdata=mFd6228vyjEBn7K5yVMwxyHVZePFOQWXMuSh0nqmXbE%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
> > [hidden email]<mailto:[hidden email]>
> > https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&amp;reserved=0<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&data=02%7C01%7CESWRIGHT%40pitt.edu%7C97942eff1d0444324e2008d7ec016278%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637237363009853380&sdata=VHp2u3MPUcoi5R4m%2FCg0oQwu5awui5IEEs8QnaIimmM%3D&reserved=0>
>
> _______________________________________________
> R-SIG-Mac mailing list
> [hidden email]<mailto:[hidden email]>
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&data=02%7C01%7CESWRIGHT%40pitt.edu%7C97942eff1d0444324e2008d7ec016278%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637237363009853380&sdata=VHp2u3MPUcoi5R4m%2FCg0oQwu5awui5IEEs8QnaIimmM%3D&reserved=0>


--
Regards
Dmitriy Selivanov


        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-Mac mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Simon Urbanek
I have now created a page about this:

http://mac.r-project.org/openmp

which also provides libomp binaries for all recent versions of Xcode (and more).

Important note: this is about Xcode - it is NOT about using Homebrew tools nor the custom compilers we used before R 4.0.0. Both of the latter are not suitable for use with R 4.0.0 binaries.

Please give it a shot. Thanks for those participating in the discussion.

Cheers,
Simon



> On 1/05/2020, at 2:23 AM, Wright, Erik Scott <[hidden email]> wrote:
>
> Hi Kevin et al.,
>
> The setup you suggested did not work for me, but I was able to get OpenMP to work on Mac (10.13) with R v4.0 packages.  Here's what I did:
>
> (1) After installing Homebrew, ran
> brew install libomp
> # Note it is also possible to install from OpenMP Source code: https://releases.llvm.org/download.html#10.0.0
> (2) Determined the install path with
> brew --prefix libomp
> # In my case /usr/local/opt/libomp
> (3) Added lines to ~/.R/Makevars
> CC=/usr/local/clang4/bin/clang -fopenmp -I/usr/local/opt/libomp/include
> LDFLAGS=-L/usr/local/opt/libomp/lib
>
> I imagine the process is similar for C++ code by setting CXX.  Now parallelization for C code with OpenMP is working again on Mac.
>
> As always, I am thankful to the R community for helping problem solve.
>
> I wish more direction along these lines could be added to mac.r-project.org
>
> Erik
>
>
>> On Apr 29, 2020, at 1:51 AM, Dmitriy Selivanov <[hidden email]> wrote:
>>
>> Thanks, Kevin, I can confirm suggested setup works fine so far. Thank you!
>>
>> 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.
>>
>> Thats understandable.
>>
>> On Sat, Apr 25, 2020 at 8:09 PM Kevin Ushey <[hidden email]> wrote:
>> 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
>> of macOS.
>>
>> Cunningham's law will hopefully ensure someone else will chime in if
>> I've got something wrong :-)
>>
>> Best,
>> Kevin
>>
>> On Sat, Apr 25, 2020 at 8:29 AM Wright, Erik Scott <[hidden email]> 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.
>> >
>> > Thanks,
>> > Erik
>> >
>> >
>> > > On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <[hidden email]> 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&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&amp;sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&amp;reserved=0<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&amp;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
>> > > [hidden email]
>> > > https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&amp;reserved=0
>> >
>> > _______________________________________________
>> > R-SIG-Mac mailing list
>> > [hidden email]
>> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>>
>> --
>> Regards
>> Dmitriy Selivanov
>

_______________________________________________
R-SIG-Mac mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Dmitriy Selivanov
Thank you Simon for the official instruction and explanation about caveats!
I've tried to use libomp (9.0.1) you've provided and everything works
smoothly.
With new R4.0 toolchain and optional openmp support we got really good
tradeoff between simplicity for the majority of the users and feature-rich
set-up for more tech-savvy users.


On Fri, May 1, 2020 at 5:29 AM Simon Urbanek <[hidden email]>
wrote:

> I have now created a page about this:
>
> http://mac.r-project.org/openmp
>
> which also provides libomp binaries for all recent versions of Xcode (and
> more).
>
> Important note: this is about Xcode - it is NOT about using Homebrew tools
> nor the custom compilers we used before R 4.0.0. Both of the latter are not
> suitable for use with R 4.0.0 binaries.
>
> Please give it a shot. Thanks for those participating in the discussion.
>
> Cheers,
> Simon
>
>
>
> > On 1/05/2020, at 2:23 AM, Wright, Erik Scott <[hidden email]> wrote:
> >
> > Hi Kevin et al.,
> >
> > The setup you suggested did not work for me, but I was able to get
> OpenMP to work on Mac (10.13) with R v4.0 packages.  Here's what I did:
> >
> > (1) After installing Homebrew, ran
> > brew install libomp
> > # Note it is also possible to install from OpenMP Source code:
> https://releases.llvm.org/download.html#10.0.0
> > (2) Determined the install path with
> > brew --prefix libomp
> > # In my case /usr/local/opt/libomp
> > (3) Added lines to ~/.R/Makevars
> > CC=/usr/local/clang4/bin/clang -fopenmp -I/usr/local/opt/libomp/include
> > LDFLAGS=-L/usr/local/opt/libomp/lib
> >
> > I imagine the process is similar for C++ code by setting CXX.  Now
> parallelization for C code with OpenMP is working again on Mac.
> >
> > As always, I am thankful to the R community for helping problem solve.
> >
> > I wish more direction along these lines could be added to
> mac.r-project.org
> >
> > Erik
> >
> >
> >> On Apr 29, 2020, at 1:51 AM, Dmitriy Selivanov <
> [hidden email]> wrote:
> >>
> >> Thanks, Kevin, I can confirm suggested setup works fine so far. Thank
> you!
> >>
> >> 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.
> >>
> >> Thats understandable.
> >>
> >> On Sat, Apr 25, 2020 at 8:09 PM Kevin Ushey <[hidden email]>
> wrote:
> >> 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
> >> of macOS.
> >>
> >> Cunningham's law will hopefully ensure someone else will chime in if
> >> I've got something wrong :-)
> >>
> >> Best,
> >> Kevin
> >>
> >> On Sat, Apr 25, 2020 at 8:29 AM Wright, Erik Scott <[hidden email]>
> 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.
> >> >
> >> > Thanks,
> >> > Erik
> >> >
> >> >
> >> > > On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <
> [hidden email]> 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&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&amp;sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&amp;reserved=0
> <
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&amp;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
> >> > > [hidden email]
> >> > >
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&amp;reserved=0
> >> >
> >> > _______________________________________________
> >> > R-SIG-Mac mailing list
> >> > [hidden email]
> >> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> >>
> >>
> >> --
> >> Regards
> >> Dmitriy Selivanov
> >
>
>

--
Regards
Dmitriy Selivanov

        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-Mac mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Balamuta, James Joseph
In reply to this post by Simon Urbanek
Simon,

Thank you for the official instructions on using OpenMP with R 4.0.0!

Also, thanks for making the source behind mac.r-project.org available on GitHub!
https://github.com/s-u/R-mac-dev

Would you consider creating an organization to house all repositories related to R for macOS in a manner similar to R for Windows?

e.g. https://github.com/r-windows 

Best,

JJB

On 4/30/20, 8:10 PM, "R-SIG-Mac on behalf of Simon Urbanek" <[hidden email] on behalf of [hidden email]> wrote:

    I have now created a page about this:

    http://mac.r-project.org/openmp

    which also provides libomp binaries for all recent versions of Xcode (and more).

    Important note: this is about Xcode - it is NOT about using Homebrew tools nor the custom compilers we used before R 4.0.0. Both of the latter are not suitable for use with R 4.0.0 binaries.

    Please give it a shot. Thanks for those participating in the discussion.

    Cheers,
    Simon



    > On 1/05/2020, at 2:23 AM, Wright, Erik Scott <[hidden email]> wrote:
    >
    > Hi Kevin et al.,
    >
    > The setup you suggested did not work for me, but I was able to get OpenMP to work on Mac (10.13) with R v4.0 packages.  Here's what I did:
    >
    > (1) After installing Homebrew, ran
    > brew install libomp
    > # Note it is also possible to install from OpenMP Source code: https://releases.llvm.org/download.html#10.0.0
    > (2) Determined the install path with
    > brew --prefix libomp
    > # In my case /usr/local/opt/libomp
    > (3) Added lines to ~/.R/Makevars
    > CC=/usr/local/clang4/bin/clang -fopenmp -I/usr/local/opt/libomp/include
    > LDFLAGS=-L/usr/local/opt/libomp/lib
    >
    > I imagine the process is similar for C++ code by setting CXX.  Now parallelization for C code with OpenMP is working again on Mac.
    >
    > As always, I am thankful to the R community for helping problem solve.
    >
    > I wish more direction along these lines could be added to mac.r-project.org
    >
    > Erik
    >
    >
    >> On Apr 29, 2020, at 1:51 AM, Dmitriy Selivanov <[hidden email]> wrote:
    >>
    >> Thanks, Kevin, I can confirm suggested setup works fine so far. Thank you!
    >>
    >> 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.
    >>
    >> Thats understandable.
    >>
    >> On Sat, Apr 25, 2020 at 8:09 PM Kevin Ushey <[hidden email]> wrote:
    >> 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
    >> of macOS.
    >>
    >> Cunningham's law will hopefully ensure someone else will chime in if
    >> I've got something wrong :-)
    >>
    >> Best,
    >> Kevin
    >>
    >> On Sat, Apr 25, 2020 at 8:29 AM Wright, Erik Scott <[hidden email]> 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.
    >> >
    >> > Thanks,
    >> > Erik
    >> >
    >> >
    >> > > On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <[hidden email]> 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&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&amp;sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&amp;reserved=0<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&amp;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
    >> > > [hidden email]
    >> > > https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&amp;reserved=0
    >> >
    >> > _______________________________________________
    >> > R-SIG-Mac mailing list
    >> > [hidden email]
    >> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
    >>
    >>
    >> --
    >> Regards
    >> Dmitriy Selivanov
    >

    _______________________________________________
    R-SIG-Mac mailing list
    [hidden email]
    https://stat.ethz.ch/mailman/listinfo/r-sig-mac

_______________________________________________
R-SIG-Mac mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Manuel Spínola
That will be a great idea. I don’t know much of programming and I get
confused with so many technical details.

Manuel Spínola

On Fri, May 1, 2020 at 10:32 Balamuta, James Joseph <[hidden email]>
wrote:

> Simon,
>
> Thank you for the official instructions on using OpenMP with R 4.0.0!
>
> Also, thanks for making the source behind mac.r-project.org available on
> GitHub!
> https://github.com/s-u/R-mac-dev
>
> Would you consider creating an organization to house all repositories
> related to R for macOS in a manner similar to R for Windows?
>
> e.g. https://github.com/r-windows
>
> Best,
>
> JJB
>
> On 4/30/20, 8:10 PM, "R-SIG-Mac on behalf of Simon Urbanek" <
> [hidden email] on behalf of [hidden email]>
> wrote:
>
>     I have now created a page about this:
>
>     http://mac.r-project.org/openmp
>
>     which also provides libomp binaries for all recent versions of Xcode
> (and more).
>
>     Important note: this is about Xcode - it is NOT about using Homebrew
> tools nor the custom compilers we used before R 4.0.0. Both of the latter
> are not suitable for use with R 4.0.0 binaries.
>
>     Please give it a shot. Thanks for those participating in the
> discussion.
>
>     Cheers,
>     Simon
>
>
>
>     > On 1/05/2020, at 2:23 AM, Wright, Erik Scott <[hidden email]>
> wrote:
>     >
>     > Hi Kevin et al.,
>     >
>     > The setup you suggested did not work for me, but I was able to get
> OpenMP to work on Mac (10.13) with R v4.0 packages.  Here's what I did:
>     >
>     > (1) After installing Homebrew, ran
>     > brew install libomp
>     > # Note it is also possible to install from OpenMP Source code:
> https://releases.llvm.org/download.html#10.0.0
>     > (2) Determined the install path with
>     > brew --prefix libomp
>     > # In my case /usr/local/opt/libomp
>     > (3) Added lines to ~/.R/Makevars
>     > CC=/usr/local/clang4/bin/clang -fopenmp
> -I/usr/local/opt/libomp/include
>     > LDFLAGS=-L/usr/local/opt/libomp/lib
>     >
>     > I imagine the process is similar for C++ code by setting CXX.  Now
> parallelization for C code with OpenMP is working again on Mac.
>     >
>     > As always, I am thankful to the R community for helping problem
> solve.
>     >
>     > I wish more direction along these lines could be added to
> mac.r-project.org
>     >
>     > Erik
>     >
>     >
>     >> On Apr 29, 2020, at 1:51 AM, Dmitriy Selivanov <
> [hidden email]> wrote:
>     >>
>     >> Thanks, Kevin, I can confirm suggested setup works fine so far.
> Thank you!
>     >>
>     >> 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.
>     >>
>     >> Thats understandable.
>     >>
>     >> On Sat, Apr 25, 2020 at 8:09 PM Kevin Ushey <[hidden email]>
> wrote:
>     >> 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
>     >> of macOS.
>     >>
>     >> Cunningham's law will hopefully ensure someone else will chime in if
>     >> I've got something wrong :-)
>     >>
>     >> Best,
>     >> Kevin
>     >>
>     >> On Sat, Apr 25, 2020 at 8:29 AM Wright, Erik Scott <
> [hidden email]> 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.
>     >> >
>     >> > Thanks,
>     >> > Erik
>     >> >
>     >> >
>     >> > > On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <
> [hidden email]> 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&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&amp;sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&amp;reserved=0
> <
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&amp;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
>     >> > > [hidden email]
>     >> > >
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&amp;reserved=0
>     >> >
>     >> > _______________________________________________
>     >> > R-SIG-Mac mailing list
>     >> > [hidden email]
>     >> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>     >>
>     >>
>     >> --
>     >> Regards
>     >> Dmitriy Selivanov
>     >
>
>     _______________________________________________
>     R-SIG-Mac mailing list
>     [hidden email]
>     https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
> _______________________________________________
> R-SIG-Mac mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
--
*Manuel Spínola, Ph.D.*
Instituto Internacional en Conservación y Manejo de Vida Silvestre
Universidad Nacional
Apartado 1350-3000
Heredia
COSTA RICA
[hidden email] <[hidden email]>
[hidden email]
Teléfono: (506) 8706 - 4662
Personal website: Lobito de río <https://sites.google.com/site/lobitoderio/>
Institutional website: ICOMVIS <http://www.icomvis.una.ac.cr/>

        [[alternative HTML version deleted]]

_______________________________________________
R-SIG-Mac mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Reply | Threaded
Open this post in threaded view
|

Re: [R-SIG-Mac] OpenMP on CRAN (Simon Urbanek)

Simon Urbanek
In reply to this post by Balamuta, James Joseph
JJB,

good idea, I didn't think of it, I have now moved this one and the recipes repo to

https://github.com/R-macos

Cheers,
Simon


> On 2/05/2020, at 4:32 AM, Balamuta, James Joseph <[hidden email]> wrote:
>
> Simon,
>
> Thank you for the official instructions on using OpenMP with R 4.0.0!
>
> Also, thanks for making the source behind mac.r-project.org available on GitHub!
> https://github.com/s-u/R-mac-dev
>
> Would you consider creating an organization to house all repositories related to R for macOS in a manner similar to R for Windows?
>
> e.g. https://github.com/r-windows 
>
> Best,
>
> JJB
>
> On 4/30/20, 8:10 PM, "R-SIG-Mac on behalf of Simon Urbanek" <[hidden email] on behalf of [hidden email]> wrote:
>
>    I have now created a page about this:
>
>    http://mac.r-project.org/openmp
>
>    which also provides libomp binaries for all recent versions of Xcode (and more).
>
>    Important note: this is about Xcode - it is NOT about using Homebrew tools nor the custom compilers we used before R 4.0.0. Both of the latter are not suitable for use with R 4.0.0 binaries.
>
>    Please give it a shot. Thanks for those participating in the discussion.
>
>    Cheers,
>    Simon
>
>
>
>> On 1/05/2020, at 2:23 AM, Wright, Erik Scott <[hidden email]> wrote:
>>
>> Hi Kevin et al.,
>>
>> The setup you suggested did not work for me, but I was able to get OpenMP to work on Mac (10.13) with R v4.0 packages.  Here's what I did:
>>
>> (1) After installing Homebrew, ran
>> brew install libomp
>> # Note it is also possible to install from OpenMP Source code: https://releases.llvm.org/download.html#10.0.0
>> (2) Determined the install path with
>> brew --prefix libomp
>> # In my case /usr/local/opt/libomp
>> (3) Added lines to ~/.R/Makevars
>> CC=/usr/local/clang4/bin/clang -fopenmp -I/usr/local/opt/libomp/include
>> LDFLAGS=-L/usr/local/opt/libomp/lib
>>
>> I imagine the process is similar for C++ code by setting CXX.  Now parallelization for C code with OpenMP is working again on Mac.
>>
>> As always, I am thankful to the R community for helping problem solve.
>>
>> I wish more direction along these lines could be added to mac.r-project.org
>>
>> Erik
>>
>>
>>> On Apr 29, 2020, at 1:51 AM, Dmitriy Selivanov <[hidden email]> wrote:
>>>
>>> Thanks, Kevin, I can confirm suggested setup works fine so far. Thank you!
>>>
>>> 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.
>>>
>>> Thats understandable.
>>>
>>> On Sat, Apr 25, 2020 at 8:09 PM Kevin Ushey <[hidden email]> wrote:
>>> 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
>>> of macOS.
>>>
>>> Cunningham's law will hopefully ensure someone else will chime in if
>>> I've got something wrong :-)
>>>
>>> Best,
>>> Kevin
>>>
>>> On Sat, Apr 25, 2020 at 8:29 AM Wright, Erik Scott <[hidden email]> 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.
>>>>
>>>> Thanks,
>>>> Erik
>>>>
>>>>
>>>>> On Apr 23, 2020, at 7:08 AM, Dmitriy Selivanov <[hidden email]> 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&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734&amp;sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3D&amp;reserved=0<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmac.r-project.org%2F&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=5XR5LJuAKu4%2B3%2FUHsWVPMlyXTLY87P6OF%2FP%2FTZt1W8Y%3D&amp;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
>>>>> [hidden email]
>>>>> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&amp;data=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728&amp;sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3D&amp;reserved=0
>>>>
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> [hidden email]
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>
>>>
>>> --
>>> Regards
>>> Dmitriy Selivanov
>>
>
>    _______________________________________________
>    R-SIG-Mac mailing list
>    [hidden email]
>    https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>

_______________________________________________
R-SIG-Mac mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-mac