With its 50th anniversary this year, the Fortran programming language is one of the oldest programming languages and is still widely used in the scientific community. Eric McIntosh looks back at the usage and development of Fortran at CERN.
50 ans de FORTRAN
En février 1957, la création du langage de programmation FORTRAN était formellement proclamée. Nommé selon un acronyme du Mathematical FORmula TRANslating System d'IBM, le FORTRAN a été élaboré par une équipe de projet d'IBM. C'était l'un des tout premiers compilateurs de langage de haut niveau développés et il reste très utilisé au sein de la communauté scientifique. Au fil des ans, il a été perfectionné et a trouvé des extensions dans plusieurs dialectes: FORTRAN I, II, III, IV et 66, 77 puis, plus récemment, Fortran 90/95. La version FORTRAN 2003 sortira bientôt et les discussions sont en cours pour définir la version 2008. Dans cet article, Eric McIntosh retrace l'utilisation et le développement du FORTRAN au CERN, où ce langage est arrivé en 1961.
In February 1957, the Fortran programming language was formally announced to the world. FORTRAN was an acronym for the IBM Mathematical FORmula TRANslating System and was developed by an IBM project team, whose leader John Backus sadly died earlier this year. This compiler was one of the first high-level language compilers ever developed. Before that time, computers had been programmed in the machine language itself or in a simple higher-level language like Alphacode, User Code or Autocode for the Ferranti Mercury at CERN.
Fortran came to CERN in 1961 when the laboratory acquired an IBM 709 computer that came with a free Fortran compiler. This language was quickly recognized to be a significant step forward in programming capability and allowed collaboration and program interchange with the US laboratories. The only alternative high-level language at this time was ALGOL, which was more structured but not as adaptable to the data-handling requirements of a high-energy physics institute. In addition, attempts to define a standard for ALGOL dragged on and Fortran quickly became the language of choice for scientific and technical programming.
Fortran was developed and extended through several dialects: FORTRAN I, II, III, IV and 66, 77, and more recently, Fortran 90/95. Fortran 2003 is coming soon and discussions are under way to define 2008. CERN's own Fortran dialect was never widely adopted and was superseded by the agreed International Standards.
Several machine-specific Fortran-callable routines (in Assembler or later the C language) always had to be provided, for example for bit and byte manipulation of physics data or for the numeric conversion of the multiple character, integer and floating-point representations. Thus, even a well-written program conforming to standards was not really portable between big-endian, little-endian, 32-bit, 60-bit or 64-bit machines with different character sets. Indeed, this was so much the case that the first CERN benchmark suite developed in the 1970s to evaluate performance of computer processors ran on IBM-compatible machines only.
On the other hand, the Fortran language was well-suited to building libraries of useful subroutines, packages and complete programs, which were widely distributed. One of the most successful of these was the CERN Program Library, a large collection of general-purpose programs that were orientated towards the needs of high-energy physics. However, since they were nearly all of a general mathematical or data-handling nature, these programs were applicable to a wide range of problems. The library contains about 2500 subroutines grouped into 450 program packages, with 80% being written in Fortran – mostly FORTRAN 77 – and the remainder in C or assembly code (but usually still with a Fortran version available). The library was ported to nearly all computers in use within high-energy physics and distributed in binary and source form to most collaborating institutes, as well as to hundreds of non-high-energy physics institutes. It reached its peak in the LEP era and while frozen for some years, is still widely used today.
Indeed, the wide adoption of FORTRAN 77 – the ASCII character set and the IEEE standard for floating-point arithmetic with 32-bit and 64-bit words – has greatly facilitated program portability. Fortran was the language at CERN until well into the last decade of the 20th century, while other languages like PL/1, PASCAL, BASIC, Modula-1 came and went. All this changed with the advent of the first PCs in the 1980s and the World Wide Web; computing was no longer dominated by scientific and technical applications. CERN recognized that, to produce and maintain the huge amount of software required by the experiments, it needed object-orientated and fully structured programs for the LHC era.
Also in the 1980s, discussions on the next version of the Fortran standard – known as 8X at the time – were blocked in the committees involved. The US committee X3J3, with around 50 members, manufacturers, large laboratories and other users, expected the ISO WG5 committee to adopt its recommendations. Instead, a stalemate ensued over the content and a compromise Fortran 90 was not reached until 1991.
Michael Metcalf, formerly of CERN and co-author of Fortran 90/95 Explained, was a member and significant contributor to X3J3 and must have been appalled at the delays. CERN therefore adopted C++ in the 1990s as the recommended programming language for the LHC experiments. Nonetheless, the accelerator and engineering communities at CERN continue to use Fortran. The LHC magnet design program ROXIE, accelerator design tools like SixTrack and MAD-X (the MAD 8 successor) or the PS operational tool for phase space tomography are recent developments in modern Fortran. Even the LHC experiments still continue to use some existing Fortran applications for simulated-event generation.
Today, Fortran 95 provides all desirable object-orientated and structured programming features, pointers and overloaded operators, and is extremely efficient in the handling of arrays. There are free gfortran and g95 compilers, as well as the excellent NAG f95 library and a variety of other commercial products.
Finally, there is no need to be a religious extremist; these days, procedures in different languages can be intermixed (which will only become easier). Different subsets of applications can be written in the most appropriate language, e.g. Java for the web, and all can be glued together in a PYTHON framework. On the other hand, it is also possible to misuse almost any language: C++ includes C, and Fortran still has the GO TO function.
Fortran is the language of high-performance technical computing – even if this is an increasingly smaller segment of today's computing activities. In 1990, the former IT division leader Paolo Zanella wrote: "If I had to pick one thing likely to still be alive 30 years from now, I would choose Fortran."