- Advertisement
- IBM XL Fortran v.8.1IBM XL Fortran 8.1 brings a highly efficient, high-quality IDEs and coding tool. Beta preview of the next addition to family of Fortran Compilers! XL Fortran for Mac OS X is based on the proven performance of XL Fortran for ...
- Pro Fortran Compiler Suite v.9.0Pro Fortran Compiler Suite 9.0 is a program which is built for Fortran development on Macintosh. Included with the tool kit are both Fortran 95 and C/C++ compilers, a powerful IDE, industry leading Fx2A?? debugging environment, math and VAX/Unix ...
- FORTRAN Unit Test Framework (FRUIT) v.2.7FORTRAN Unit Test Framework, written in FORTRAN 95. So that all FORTRAN features can be tested. FRUIT has assertion, fixture, setup, teardown, report, spec, driver generation. Rake used as build tool. Tutorials at ...
- Open Fortran Project v.0.8.3The Open Fortran Project (OFP) provides a Fortran 2008 compliant parser and associated tools. These tools provide a Java and C API for actions called when parser rules are completed. It also provides Fortran interfaces to the OpenCL runtime ...
- CCRG GNU Fortran 95 Compiler v.20030418Patches for GNU Fortran 95 Compiler. Contributed by Creative Compiler Research Group.
- IBM XL C/C++ v.6.0IBM XL C/C++ 6.0 is an advanced program which satisfies you because it works great and has a friendly interface. Preview Beta compilers for Mac OS X. IBM is preparing its industry-leading C, C++ and Fortran compilers to exploit the Apple PowerMac ...
- Open Watcom v.1.9Open Watcom is a project of the open source community to maintain and enhance the Watcom C, C++, and Fortran cross compilers and tools. An Open Source license from Sybase allows free commercial and non-commercial use of Open Watcom. In a single ...
- Doxygen for Mac OS X v.1.7.6.1Doxygen is a documentation system for C++, C, Java, Objective-C, Python, IDL (Corba and Microsoft flavors), Fortran, VHDL, PHP, C#, and to some extent D. It can help you in three ways: 1. It can generate an on-line documentation browser (in ...
- Numpy for Mac OS X v.1.6.1NumPy is the fundamental package needed for scientific computing with Python. It contains among other things: * a powerful N-dimensional array object * sophisticated (broadcasting) functions * tools for integrating C/C++ and Fortran code * ...
Absoft Pro Fortran compilers and debuggers are fast, efficient, and designed to provide you the best Fortran experience on Windows, Mac, and Linux. The IBM XLFortran Mac OS X beta works very well after you figure out how to use it. I have personally used 90 and it is also usable for 77 and 95. But, after it goes to final versions you would. The optimization reports from the Intel Fortran Compiler are extremely useful and take advantage of the explicit vectorization compiler features as much as possible. Intel® Math Kernel Library is a great collection of ready-to-use math libraries that speed development and application performance. A Professional Fortran Development Environment Simply Fortran is a complete Fortran solution for Apple macOS and Mac OSX computers. Designed from the beginning for the Fortran language, Simply Fortran delivers a reliable Fortran compiler on the Mac platform with all the necessary productivity tools that professionals expect.
- Blitz++ Library v.0.9Blitz++ is a C++ class library for scientific computing which provides performance on par with Fortran 77/90. It uses template techniques to achieve high performance. Blitz++ provides dense arrays and vectors, random number generators, and small ...
- AquaTerm (Mac OS X graphics terminal) v.rc.1.0.1AquaTerm is a Mac OS X grahics renderer. It allows command line applications written in ObjC, C, FORTRAN, Lisp, Perl or Python to display vector graphics, text and images using a simple API. Adapters for gnuplot, PGPLOT, and PLplot exists as ...
- F2cpp v.1.1.2f2cpp is a python script to convert Fortran 77 to C++ code. The output files of f2cpp script, in contrast to the well-known f2c translator, can be easy read by ...
- Freesteam v.2.0Open source steam property routines in C. Implements the IAPWS-IF97 steam tables from the International Association for the Properties of Water and Steam. Includes two-way property solvers and test suite. Can be used from C/C++, Fortran Python and ...
- Ftagshtml v.0.521Ftagshtml converts fortran code into HTML in order to browse and navigate in the call tree for any routine or abstract fortran 90 interface. Compatible with basic C analysis, mixing with fortran 77 and ...
- Generating derivative structures v.1.0A Fortran 95 implementation of an algorithm for generating derivative structures of a parent lattice. The algorithm is discussed in detail in: Gus L. W. Hart and Rodney Forcade, 'A new approach to generating derivative structures,' Phys. Rev B.
- Haggies v.1.0haggies is an optimizing code generator. It can read in expressions in common notation and generate output for many programming languages including C/C++, Java, Fortran, Python and many ...
- PARAMESH v.4.1PARAMESH is a package of Fortran 90 subroutines designed to provide anapplication developer with an easy route to extend an existing serialcode which uses a logically cartesian structured mesh into a parallelcode with adaptive mesh ...
- ReactionLab v.b.1.1ReactionLab is a software package aimed for a unified computer environment to kinetic modeling of chemical reaction systems. The present implementation is founded on Matlab and Java-Swing GUI, with an interface to legacy C (and Fortran) ...
- ROBODoc v.4.99.38ROBODoc is a documentation tool. It extracts the documentation from your source code and formats it in HTML, RTF, TeX, XML DocBook (PDF), or ASCII. Works with C, C++, Fortran, Perl, Scripts, Assembler, Tcl, Basic, and any language that supports ...
- UPS debugger v.3.38.beta2UPS is a source level C, C++ and Fortran debugger with an X windowsinterface. It's a very light debugger, but is quite efficient and workswell. An ANSI compliant C interpreter is ...
- PFUnit pFUnit is a Fortran testing framework created by
- Aiseesoft Mac PDF to Excel Converter Aiseesoft Mac PDF to Excel Converter can help users easily
- Understand for Mac OS The Swiss army knife of tools for source navigation, code
- Pro Fortran Compiler Suite Pro Fortran Compiler Suite 9.0 is a program which is built
- IBM XL Fortran IBM XL Fortran 8.1 brings a highly efficient, high-quality
- Open Watcom Open Watcom is a project of the open source community to
- Guiffy for Mac and Linux At Guiffy our focus is Advanced Cross-Platform Diff/Merge
- Model Railroad System Run your railroad, from running trains to operating switches
- AquaTerm (Mac OS X graphics terminal) AquaTerm is a Mac OS X grahics renderer. It allows command
- Numpy for Mac OS X NumPy is the fundamental package needed for scientific
At WWDC 2020 earlier this year, Apple announced a transition from Intel toARM-based processors in their laptops. This blog is about the prospects ofwhen R will work on that platform, based on experimentation on a developermachine running A12Z, one of the “Apple silicon” processors.
The new platform will includeRosetta 2,a dynamic translation frameworkwhich runs binaries built for 64-bit Intel Macs using just-in-time, dynamictranslation of binary code. The good news is that R seems to be working finewith the dynamic translation, so R users don’t need to worry even if they usecurrent releases. However, the interesting question is whether R will also worknatively. Native execution is expected to be faster, and the transitionprobably has to be done eventually, anyway.
The executive summary is: while there is currently no released Fortrancompiler for the platform, a development version of GNU Fortran alreadyseems to be working fine. There are some surprising results with NaNpayload propagation leading to unexpected results when computing withnumeric NAs, but these can be overcome by changing the mode of thefloating-point unit, which has already been done in R-devel. More detailsfollow in this post.
R needs a Fortran 90 compiler
R needs at least a Fortran 90 compiler to build. Most of the Fortran codein R and base and recommended packages is still in Fortran 77, so it can betranslated by f2c
to C and compiled by a C compiler. However, some codealready uses Fortran 90 features and back-porting that would require anon-trivial effort.
In addition, R ships with a slightly modified version of reference LAPACKand BLAS which need a Fortran 90 compiler to build. It is highly preferableto have reference LAPACK/BLAS available also on the new platform, even thoughApple provides an optimized version of BLAS and LAPACK as part of the Accelerateframework in macOS.
GCC’s GFortran supports 64-bit ARMs: an earlier blog postfrom Maywas about building and testing R on Linux running on 64-bit ARM (Aarch64)inside QEMU emulator. However, the Apple silicon platform uses a differentapplication binary interface (ABI) which GFortran does not support, yet.
Currently, there seems to be no other Fortran 90 compiler, neither free norcommercial. Specifically, LLVM’s Fortran compiler (now called Flang again)is not yet finished.
Building development version of GCC/GFortran
While GFortran does not support Apple silicon yet (neither any release northe GCC trunk), there is a private development branch of GCC includingGFortran by Iain Sandoe, which we experimented with.
Building GCC from source as usual requires first building also GMP, MPFR andMPC for the platform. GMP (version 6.2.0) required back-porting a patchfrom the trunk (configure script for Apple silicon, assembler macros).Re-generating the configure script and make files natively also requiredbuilding libtool. The configure script for GMP had to be explicitly runwith --build=aarch64-apple-darwin20.0.0
, even when building natively. Theconfigure script for GCC was run with --with-sysroot
, specifying adirectory to MacOSX.sdk
installed via xcode-select -p
.
Testing R
R requires a number of dependencies, which can be built natively followingR Installation and Administration,using the Apple/LLVM toolchain provided by Apple (Fortran compiler is not needed).We have also compiled a native build of Subversion, even though in principleone could build R from a tarball.
R and recommended packages were built using Apple/LLVM clang to compile C(with CFLAGS=-Wno-error=implicit-function-declaration
) and Objective C andusing the development version of GFortran to compile Fortran code.
A number of tests for R and recommended packages have failed for aplatform-specific reason, but it turned out that all for the same reason:surprising propagation of NaN payload, where e.g. NA * 1
is NaN
.
NA/NaN payload propagation
R’s NA for floating point numbers is represented using NaN with a specialpayload value. NaNs that originate from computations not involving NA havea different (e.g. zero) payload, so can be distinguished from NA. NaNs areoften passed to computations inside R without explicit checks and the samehappens inside package code and external numerical code, which have no ideaabout R’s NA concept nor representation.
The IEEE 754 standard for floating point arithmetics does not mandate howNaN payloads should be propagated through computations. The result ofcomputations involving NAs and/or other NaNs depends on the CPU/floatingpoint unit, on compiler optimizations (compiler may re-order computations),and on the algorithm (e.g. it is tempting to ignore input values not neededto compute the result under the assumption they are finite, but withoutactually checking they are finite).
More information can be found in R’s online help (?NA
, ?NaN
), includingdisclaimers that the difference between NA and NaN should not be relied on(citing in the wording of recent R-devel):
Computations involving ‘NaN’ will return ‘NaN’ or perhaps ‘NA’: which ofthose two is not guaranteed and may depend on the R platform (sincecompilers may re-order computations).
Numerical computations using ‘NA’ will normally result in ‘NA’: a possibleexception is where ‘NaN’ is also involved, in which case either might result(which may depend on the R platform). However, this is not guaranteed andfuture CPUs and/or compilers may behave differently.
Intel FPUs worked relatively well with respect to R NAs: binary operations withNAs resulted in NAs, even when NaNs were involved (based on experimentation).However, currently R on Intel machines is typically built to use SSEinstructions for computations, which do not work that well for R NAs: binaryoperations with NAs only result in NA when the other argument is not a NaN, orwhen the NA is the first, so NaN + NA
is NaN
but NA + NaN
is NA
. As64-bit Intel with SSE has most likely been the prevailing setup for R recently,tests have already been updated to accept this behavior.
However, it turns out that on A12Z, R’s NA becomes a normal NaN after anybinary operation (the payload is lost), so even NA * 1
is NaN
. This iswithin what has been warned against in the R documentation cited above, butstill a number of tests for R and recommended packages capture the(documented as unreliable) behavior expecting that operations like thiswill return NA
. We have not investigated how many of other CRAN/BIOCpackages do.
The ARM architecture floating point units (VFP, NEON) support RunFast mode,which includes flush-to-zero and default NaN. The latter means that payloadof NaN operands is not propagated, all result NaNs have the default payload,so in R, even NA * 1
is NaN
. Luckily, RunFast mode can be disabled, andwhen it is, the NaN payload propagation is friendlier to R NAs than withIntel SSE (NaN + NA
is NA
). We have therefore updated R to disableRunFast mode on ARM on startup, which resolved all the issues observed.
We have not run into this issue earlier as RunFast has been disabled bydefault on other platforms, including Raspberry Pi (tested on an old model 2with 32-bit ARM, BCM2835) and on QEMU emulating Aarch64 (64-bit ARM,Cortex-A72).
Summary
It turns out there is hope that R will work on Apple silicon. A usable Fortran90 compiler for Apple silicon will hopefully be available relatively soon, sincethe development version of GFortran already seems to be working (check-all
passed for R including reference LAPACK/BLAS) and there is a strong need forsuch compiler not only for R, but any scientific computing on that platform.
Fortran 90 Compiler Mac
Any package native code that wants to reliably preserve NAs (computationswith at least one NA value on input provide NA on output) has to includeexplicit checks, be it for computations implemented in the package nativecode or in external libraries. That is the only portable, reliable way, andhas been the only one for long time. Packages that choose to not guarantee suchpropagation, on the other hand, should not capture in tests thecoincidental propagation on the developer’s platform. On ARM, and hencealso Apple silicon, R now masks some of these issues by disabling theRunFast mode, but another new platform may appear where this won’t bepossible, and more importantly, NAs may be “lost” also due to compileroptimizations or algorithmically in external libraries.
References
Fortran 90 Compiler Mac
Apple Silicon ABI.Specifics of the application binary interface (ABI) on Apple silicon.
GCC BugzillaEnhancement/bug report with updates on development of GCC/GFortran support for Apple silicon.
Experimental GCC for Apple SiliconDevelopment branch of GCC with support for Apple silicon by Iain Sandoe.
GMP Support for Apple Silicon.GMP Support for Apple silicon by Torbjorn Granlund.
Floating point exception tracking and NAN propagationA text also on NaN payload propagation by Agner Fog.
ARM RunFast Mode (https://developer.arm.com/documentation/ddi0274/h/programmer-s-model/compliance-with-the-ieee-754-standard/ieee-754-standard-implementation-choices)Description of differences of RunFast mode from IEEE 754.