Re: [R-SIG-Mac] R for macOS Big Sur

2021-01-11 Thread Denis-Alexander Engemann
I have been using both Rosetta emulation and the homebrew builds and
everything looks very good so far.

Here are two Twitter threads on M1 benchmarks.

https://twitter.com/fxcoudert/status/1342598509418176514?s=20

https://twitter.com/dngman/status/1342580260815200257?s=20

Best,
Denis

On Mon, Jan 11, 2021 at 10:11 AM Dr Eberhard W Lisse  wrote:
>
> I use the homebrew R for the Intel and then install.packages(), 
> update.package() from scripts and  Rstudio’s Tools->.
>
> I don’t have an M1 (yet) but would be interested in seeing how that works on 
> the M1. Probably this will pull the sources and hence I would be grateful to 
> read about that.
>
>
> greetings, el
>
> —
> Sent from Dr Lisse’s iPhone
> On 11 Jan 2021, 10:05 +0200, Patrick Schratz , 
> wrote:
> > There is a [native arm64 big sur
> > binary](https://github.com/Homebrew/homebrew-core/blob/8a6807be6abb44634e7d6d153348b6bba2a5ddc6/Formula/r.rb#L16)
> > in homebrew since some days.
> >
> > On 10 Jan 2021, at 22:39, Gregory Coats via R-SIG-Mac wrote:
> >
> > > I purchased a new 13 inch Apple MacBook Pro with the M1 System on a
> > > Chip. I understand that R is not yet available compiled for the M1 SoC
> > > hardware, and so I am using Apple’s Rosetta 2.
> > > However, this MacBook Pro requires Apple macOS Big Sur. From what I
> > > see at https://mac.r-project.org/ R has not been compiled for macOS
> > > Big Sur. Is there an executable of R for macOS Big Sur available to
> > > download?
> > > Greg Coats
> > >
> > >
> > > [[alternative HTML version deleted]]
> > >
> > > ___
> > > R-SIG-Mac mailing list
> > > R-SIG-Mac@r-project.org
> > > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> >
> > [[alternative HTML version deleted]]
> >
> > ___
> > R-SIG-Mac mailing list
> > R-SIG-Mac@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
> [[alternative HTML version deleted]]
>
> ___
> 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] Apple Silicon aka M1 Macs

2020-12-25 Thread Denis-Alexander Engemann
Thank you for the feedback, this is great!

I kept investigating my particular issue and it turned out that I did
not pay sufficient attention.
I actually forgot to comment out the relevant include and lib paths
that I set in the config.site file … my bad.

As I proceeded, I encountered a few more issues.
It turned out ./configure needed a newer version of curl.
Installing it with brew did the job + linking the lib include and
pkconfig to /opt/homebrew respectively.

Currently my build efforts are stuck as libR.dylib references
_libiconv but cannot find that symbol inside libiconv, which seems to
be an old issue according to a quick google search, e.g
(https://mw.gl/posts/libiconv_mac/).
Installing and linking libiconv via brew did not work so far, I do not
manage to tell the compiler to look up the right libiconv.

On the other hand, the binary provided via brew seems to work fine.
Installing R packages from the sources worked flawlessly and the
packages seem usable.
So far I've checked out tidymodels, readr, ggplot2, ranger, grf,
glmnet (plust the dependencies).
This looks very encouraging!

Best wishes,
Denis

On Thu, Dec 24, 2020 at 10:50 PM Jeroen Ooms  wrote:
>
> On Thu, Dec 24, 2020 at 7:32 PM Denis-Alexander Engemann
>  wrote:
> >
> > Hi everyone,
> >
> > I'm finally joining the party here and so far made good progress
> > following Taras' instructions.
> >
> > Disclaimer - I'm new to working with R sources.
> > But would be very happy to help with testing and reporting to
> > accelerate support native M1 builds.
> >
> > I am using the R-4.0.3 sources with the latest gfortran release from
> > François-Xavier Coudert:
> > https://github.com/fxcoudert/gfortran-for-macOS/releases/tag/11-arm-alpha2
> >
> > Currently I'm facing some issues at step 5.
> > It seems that for some reasons liblzma cannot be found although it is
> > well installed via xz at step 3.
> > I also verified that the liblzma can be easily discovered along the lines 
> > of 3.
> >
> > The lines before ./configure stops are:
> >
> > ```
> > checking lzma.h usability... no
> > checking lzma.h presence... no
> > checking for lzma.h... no
> > configure: error: "liblzma library and headers are required"
> > ```
> >
> > As mentioned, all is well installed in the include and lib directories at:
> > /opt/homebrew/Cellar/xz/5.2.5
> >
> > Would you have a suggestion where I should link the headers/library to
> > be picked up by ./configure ?
>
> Homebrew now has an arm64 binary for R:
> https://github.com/homebrew/homebrew-core/blob/master/Formula/r.rb .
> Hence you can simply use: brew install r
>
> To tweak the build, use "brew edit r", save your changes, and then:
> brew install r --build-from-source

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


Re: [R-SIG-Mac] Apple Silicon aka M1 Macs

2020-12-24 Thread Denis-Alexander Engemann
Hi everyone,

I'm finally joining the party here and so far made good progress
following Taras' instructions.

Disclaimer - I'm new to working with R sources.
But would be very happy to help with testing and reporting to
accelerate support native M1 builds.

I am using the R-4.0.3 sources with the latest gfortran release from
François-Xavier Coudert:
https://github.com/fxcoudert/gfortran-for-macOS/releases/tag/11-arm-alpha2

Currently I'm facing some issues at step 5.
It seems that for some reasons liblzma cannot be found although it is
well installed via xz at step 3.
I also verified that the liblzma can be easily discovered along the lines of 3.

The lines before ./configure stops are:

```
checking lzma.h usability... no
checking lzma.h presence... no
checking for lzma.h... no
configure: error: "liblzma library and headers are required"
```

As mentioned, all is well installed in the include and lib directories at:
/opt/homebrew/Cellar/xz/5.2.5

Would you have a suggestion where I should link the headers/library to
be picked up by ./configure ?

Best wishes,
Denis

On Wed, Nov 25, 2020 at 10:41 AM Taras Zakharko  wrote:
>
> Creating a native Aarch64 build of R on my M1 machine was surprisingly 
> straightforward. Here is a step-by-step instruction of what I did in case 
> someone wants to replicate it:
>
> 1. Install native homebrew as described in this blog post under “Multiple 
> Homebrews” (https://soffes.blog/homebrew-on-apple-silicon). You will need to 
> manually chown a bunch of directories, keep an eye on brew output
>
> 2. Install the following brew packages
>
>   brew install jpeg libpng libtiff pcre2 pkg-config tcl-tk xz zlib
>
>   Again, pay attention to brew output, it is possible that you will have to 
> manually reset ownership on some directories
>
> 3. Make sure that zlib can be discovered by pkg-config by making it’s pc file 
> discoverable
>
>  ln -s /opt/homebrew/Cellar/zlib/1.2.11/lib/pkgconfig/zlib.pc 
> /opt/homebrew/lib/pkgconfig/
>
> 4. Install patched gfortran, I used the precompiled package from here:
>
>  
> https://github.com/fxcoudert/gfortran-for-macOS/releases/tag/11-arm-alpha1
>
> 5. In  config.site, add the paths to homebrew libraries:
>
>  CPPFLAGS=-I/opt/homebrew/include
>  LDFLAGS=-L/opt/homebrew/lib
>
> Note: the R-admin manual tells to set CC, CXX, FC in config.sites, but it’s 
> not strictly necessary, the build will work without them
>
> 5. Run the configure script, I used
>
>   ./configure --enable-R-shlib --without-x  --enable-memory-profiling 
> --with-blas="-framework Accelerate”
>
>   Check that the summary makes sense. If PNG is disabled, it’s probably 
> because you forgot step 3
>
> 6. Build R
>
>   make -j4
>
> 7. Check that everything runs
>
>   bin/R
>
>You should see something like "Platform: arm-apple-darwin20.2.0 (64-bit)” 
> in the startup message.
>
> All core tests seems to pass and the performance is excellent.
>
> I have tried building tidyverse and it blocked on testthat. It seems that 
> testthat uses a fairly old version of Catch which doesn’t detect platform 
> correctly and tries to use some x86 inline assembly during the arm build…
>
>
> > On 23 Nov 2020, at 11:14, Prof Brian Ripley  wrote:
> >
> > As a follow-up, I now have a preliminary native build of R (using a 
> > gfortran compiled from sources forked from GCC and using minor 
> > modifications of Tomas Kalibera's instructions).
> >
> > The check timing was 148s, with Aqua (not X11) Tcl/Tk built from the 
> > sources and no X11 support, so not quite 100% comparable.
> >
> > Building the compiler took 45m elapsed with 100% CPU most of the time: the 
> > machine (which has no fan) remained cool (unlike my MBP which has a fan but 
> > rarely runs it and does get warm to the touch).
> >
> > There is a preliminary write-up on 'arm64' Macs in R-devel's R-admin manual 
> > (the version on CRAN is as usual a few days behind).
> >
> > On 17/11/2020 14:57, Prof Brian Ripley wrote:
> >> Mine (a 8GB MBA) arrived today, so I have started doing some comparisons.
> >> For the CRAN build of R 4.0.3, §2.8 of R-admin recommends checking the 
> >> installation with
> >> pdf("tests.pdf") ## optional, but prevents flashing graphics windows
> >> Sys.setenv(LC_COLLATE = "C", LC_TIME = "C", LANGUAGE = "en")
> >> tools::testInstalledBasic("both")
> >> tools::testInstalledPackages(scope = "base")
> >> tools::testInstalledPackages(scope = "recommended")
> >> That took 454s (using Rosetta) against 895s for my late-2016 MBP (2.9GHz 
> >> i5): happily nothing untoward was reported (some recommended packages give 
> >> differences from reference output on both systems).
> >> You need to install XQuartz to provide the X11() devices and support for 
> >> package Tcl/Tk: everything I tried using that worked as expected.
> >> Having done that post-installation check I would happily use the Intel R 
> >> on an M1 machine.
> >> We plan to check many of the Intel-compiled packages under