Archive for November, 2020
Earlier this week Apple announced their new, Arm-based ‘Apple Silicon’ machines to the world in a slick marketing event that had many of us reaching for our credit cards. Simultaneously, The Numerical Algorithms Group announced that they had ported their Fortran Compiler to the new platform. At the time of writing this is the only Fortran compiler publicly available for Apple Silicon although that will likely change soon as open source Fortran compilers get updated.
Fortran on your Mac! @NAGTalk announce the first Fortran Compiler for Apple Silicon Macs ahead of @Apple event #OneMoreThing – learn more https://t.co/pcCuTs2vET #AppleEvent #Apple #AppleSiliconMacs #Fortran #Compiler #SC20 @Arm pic.twitter.com/d03WsGVrUN
— NAG (@NAGTalk) November 10, 2020
Fortran? OK Boomer!
At over 60 years old, Fortran is one of the oldest programming languages that continues to be actively developed and used (The latest language specification is Fortran 2018). Routinely mocked by software engineers as old-skool (including me who, over a decade ago, suggested that it shouldn’t be taught to undergraduates), Fortran is the language that everyone overlooks as they spend their days sipping flat-whites in Starbucks while hacking away in MATLAB, R or Python on shiny Macbook Airs.
It can come as quite a shock, therefore, to discover that much of our favourite data science tools simply cannot work natively on any system that doesn’t have a Fortran compiler!
It’s Fortran all the way down
Much of the numerical functionality we routinely use today was developed decades ago and released in Fortran. More modern systems, such as R, make direct use of a lot of this code because it is highly performant and, perhaps more importantly, has been battle tested in production for decades. Numerical computing is hard (even when all of your instincts suggest otherwise) and when someone demonstrably does it right, it makes good sense to reuse rather than reinvent.
As a result, with no Fortran, there’s no R.
The Python crowd don’t get away with it either. Here are the GitHub stats for Scipy as of today
Of course, no Scipy means you also can’t have anything that depends on Scipy including things like Keras or Scikit-learn. Also, if you want good performance for linear algebra operations (Which underpins a huge number of data science and ML algorithms) then you’ll need a good BLAS implementation. Many projects use OpenBLAS (It’s a popular option in Numpy for example) which…you guessed it…is almost 49% Fortran.
Emulation for now
NAG’s Fortran compiler is excellent (it routinely tops independent charts for its checking and Fortran standards compliance for example) but it is commercial. The community needs and will demand open source (or at least free) Fortran compilers if data scientists are ever going to realise the full potential of Apple’s new hardware and I have no doubt that these are on the way. Other major silicon providers (e.g. Intel, AMD, NEC and NVIDIA/PGI) have their own Fortran compiler that co-exist with the open ones. Perhaps Apple should join the club (I suggest they talk to NAG!).
Until this is resolved, most of us will be relying on the Rosetta2 emulation…which, thankfully, is apparently pretty good!