Will R work on Apple Silicon?

rstats
apple
Will R work on Apple Silicon?
Published

November 18, 2020

Apple recently released new entry level devices using Apple-designed chips based on the ARM64 architecture, the so-called Apple Silicon that was introduced at WWDC earlier this year.

Reviews just started coming out, and everyone seems to be praising the performance of both optimised and translated software running on these new low-powered devices. Synthetic benchmarks and real-life tests are matching the performance of e.g. a MacBook Air to a 2019 16” MacBook Pro or even a 2017 iMac Pro. Which is mad!

Should I just run out and buy a new Mac?

As an R user, should you just run out and buy a new macOS device with Apple Silicon? Well, not so fast, tiger! A post on the R-developer blog dives deeper on the current status of R on Apple Silicon:

  • R seems to be running fine through the translation layer, but of course that is not optimised and performance should be worse than running natively;

  • R can already run on ARM32/ARM64 devices. Heck, it can even run on a Raspberry Pi Zero with a single-core 1 GHz CPU and 512 MB of RAM! However, before it can be compiled to Apple Silicon the whole stack of compilers will need to be updated/ported to the new architecture; work seems to be underway, so I believe it won’t take long.

  • There are inconsistencies with how NA/NaN are handled and propagated, but that is platform-specific and it is already complicated in the x86/x64 world. Writing code that can reliably preserve NA and NaN values will require ad-hoc checks.

This is just my quick executive summary, read through the blog post above for more details.

Some personal considerations

If you know me, you know how much I like tiny, silent computers. I mean, the MacBook Adorable is my favourite macOS laptop I never got to own and I got so close to buying a Surface Go 2 when it was announced earlier this year. If I had to get a desktop computer, I would probably get an Intel NUC or build into a small Mini-ITX case. And don’t get me started on Raspberry Pi boards! You bet I am very excited about the idea of a next-generation, fanless MacBook Air with great performance and excellent battery life!

Another potentially big thing is the Neural Engine that is embedded into Apple Silicon chips. Will R be able to link to that dedicated chip to accelerate machine learning (and potentially other) computations? Time will tell…

Finally, my understanding is that tools like brew and git are currently broken(-ish) on Apple Silicon. I am sure they will be updated for the new architecture soon, though.

Nevertheless, I am happy that the Mac is now an exciting platform once again after years of stagnation. I look forward to seeing how this evolves in the coming months, and I am definitely not upgrading my current laptop any time soon.

Update #1: 2020-11-23

There is now a thread on the R-SIG-Mac mailing list where Prof. Brian Ripley gives first impressions and benchmarks on building CRAN’s R 4.0.3 on a M1 MacBook Air with 8 GB of RAM.

First results seems very promising: building on top of Rosetta is actually faster than building on a 2016 2.0 GHz i5 MacBook Pro, but lots of work remains to be done to have a build ready for general use.

Furthermore, did you see those performance benchmarks for Mac-optimised TensorFlow training on Apple Silicon? I guess yes, machine learning computations will be greatly accelerated on new Apple hardware once fully optimised!