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

2020-04-25 Thread 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  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 
> >  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%2Fdata=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3Dreserved=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@r-project.org
> > https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-macdata=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3Dreserved=0
>
> ___
> R-SIG-Mac mailing list
> R-SIG-Mac@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] Strange library problem with 4.0

2020-04-25 Thread Kevin Ushey
Can you confirm that you see this even with:

R --vanilla -s -e "writeLines(.libPaths())"

If you don't see the issue there, the most likely culprit is something
in a .Rprofile that's causing the old library path to be used.

Kevin

On Sat, Apr 25, 2020 at 4:59 AM Bob Rudis  wrote:
>
> Can you try it with the "tar" method and see if it has the same behavior?
>
> I use the gzip'd tar files and have multiple versions running on
> multiple Macs and .libPaths() is not exhibiting that behavior.
>
> On Sat, Apr 25, 2020 at 5:47 AM Erich Subscriptions
>  wrote:
> >
> > I installed R 4.0 on 2 machines, an iMac and a Macbook Pro.
> > Before that, I installed RSwitch and did what the site tells to do:
> > sudo pkgutil --forget org.r-project.R.el-capitan.fw.pkg \
> >  --forget org.r-project.x86_64.tcltk.x11 \
> >  --forget org.r-project.x86_64.texinfo \
> >  --forget org.r-project.R.el-capitan.GUI.pkg
> > so that the 3.6 and 4.0 can coexist.
> >
> > I always keep the additionally installed packages in
> > ~/Library/R
> >
> > After installing R 4.0 I therefore have
> > ~/Library/R/3.6/library and ~/Library/R/4.0/library
> >
> > On the iMac, I can switch between the two versions and R will put the 
> > appropriate folder
> > in .libPaths()
> >
> > On the Macbook, however, when I run R 4.0
> > both these folders are in .libPaths().
> > This does not happen when I run R 3.6.
> >
> > How can this problem be solved?
> >
> > Erich
> >
> > ___
> > R-SIG-Mac mailing list
> > R-SIG-Mac@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
> ___
> R-SIG-Mac mailing list
> R-SIG-Mac@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


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

2020-04-25 Thread 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  
> 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%2Fdata=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415901734sdata=qlhXuEubgD6PNmkbD%2BWQy5OI9X%2BGjxSYHMNjA%2BQHZzI%3Dreserved=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@r-project.org
> https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-macdata=02%7C01%7Ceswright%40pitt.edu%7C65097590dea4453ab8cf08d7e776b868%7C9ef9f489e0a04eeb87cc3a526112fd0d%7C1%7C0%7C637232369415911728sdata=yAu4MKX2Ka5yEaoq51byWJSkbL%2FpO1HvtUsI%2BQXmtJQ%3Dreserved=0

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


Re: [R-SIG-Mac] Strange library problem with 4.0

2020-04-25 Thread Bob Rudis
Can you try it with the "tar" method and see if it has the same behavior?

I use the gzip'd tar files and have multiple versions running on
multiple Macs and .libPaths() is not exhibiting that behavior.

On Sat, Apr 25, 2020 at 5:47 AM Erich Subscriptions
 wrote:
>
> I installed R 4.0 on 2 machines, an iMac and a Macbook Pro.
> Before that, I installed RSwitch and did what the site tells to do:
> sudo pkgutil --forget org.r-project.R.el-capitan.fw.pkg \
>  --forget org.r-project.x86_64.tcltk.x11 \
>  --forget org.r-project.x86_64.texinfo \
>  --forget org.r-project.R.el-capitan.GUI.pkg
> so that the 3.6 and 4.0 can coexist.
>
> I always keep the additionally installed packages in
> ~/Library/R
>
> After installing R 4.0 I therefore have
> ~/Library/R/3.6/library and ~/Library/R/4.0/library
>
> On the iMac, I can switch between the two versions and R will put the 
> appropriate folder
> in .libPaths()
>
> On the Macbook, however, when I run R 4.0
> both these folders are in .libPaths().
> This does not happen when I run R 3.6.
>
> How can this problem be solved?
>
> Erich
>
> ___
> R-SIG-Mac mailing list
> R-SIG-Mac@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac


[R-SIG-Mac] Strange library problem with 4.0

2020-04-25 Thread Erich Subscriptions
I installed R 4.0 on 2 machines, an iMac and a Macbook Pro.
Before that, I installed RSwitch and did what the site tells to do:
sudo pkgutil --forget org.r-project.R.el-capitan.fw.pkg \
 --forget org.r-project.x86_64.tcltk.x11 \
 --forget org.r-project.x86_64.texinfo \
 --forget org.r-project.R.el-capitan.GUI.pkg
so that the 3.6 and 4.0 can coexist.

I always keep the additionally installed packages in
~/Library/R

After installing R 4.0 I therefore have
~/Library/R/3.6/library and ~/Library/R/4.0/library

On the iMac, I can switch between the two versions and R will put the 
appropriate folder 
in .libPaths()

On the Macbook, however, when I run R 4.0
both these folders are in .libPaths().
This does not happen when I run R 3.6.

How can this problem be solved?

Erich

___
R-SIG-Mac mailing list
R-SIG-Mac@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-mac