Why the Fortran programming language can be a scientific powerhouse? An observation by Professor Michael Wirth of the University of Guelph’s School of Computer Science
According to Michael Wirth, a professor at the University of Guelph’s School of Computer Science, people are often surprised to learn how widespread Fortran is in the real world. For example, many climate models were originally written in Fortran and continue to be maintained. Languages like Julia are trying to dethrone it, but I think Julia would be a better language if it came with the ISO standard,” Wirth writes.
Fortran is a programming language designed for scientific computing in the 1950s. It continues to be widely used in scientific research for supercomputers. Unlike more advanced languages, the flow of individual operations on the machine remains relatively controlled in the language, which allows for relatively computationally efficient code to be written. Fortran has evolved greatly in recent years with the appearance of the Fortran 90 standard.
According to Michael Wirth, one of the reasons Fortran still works is longevity. It’s easier to build on something originally developed in Fortran (which is backwards compatible) than to start from scratch. People always make it look easy, but many engineering projects have failed because you didn’t understand how the original software worked,” says Wirth.
Fortran is also pretty good at math, and climate models are nothing more than data processing and math.
I don’t like it when people try to say “Python would be better” because of the silly idea that its syntax is better than Fortran’s. Of course, it is more concise, but it is purely for the benefit of the programmer, not the machine,” he explains. And who’s to say that writing plainly doesn’t add a certain level of clarity, which is extremely important in applications that perform calculations.
Features of Fortran
- High performance computing: Fortran was originally designed for computationally intensive applications in science and engineering. Mature, proven compilers and libraries allow you to quickly write code that makes the most of the power of your hardware;
- Strong static typing : Fortran uses powerful static typing that allows the compiler to detect many programming errors immediately. This allows it to generate powerful binary code;
- Easy to learn and use : Fortran has a relatively small vocabulary and is surprisingly easy to learn and use. Writing most mathematical and arithmetic operations in large tables is as natural as on paper;
- Multiparadigm : Fortran allows you to write code in the style that best suits the problem: imperative, procedural, matrix, object-oriented, or functional;
- Parallel : Fortran is a parallel programming language that uses an intuitive array-like syntax to automatically transfer data between processors. It is possible to run almost the same code on a single processor, a shared multi-core memory system, a distributed memory HPC system, or a cloud-based system. The concepts of co-arrays, commands, events, and collective subroutines allow the use of different parallel programming models tailored to the programmer’s problem.
These are some of the features cited by Wirth to justify Fortran’s scientific power.
- Performance: Fortran is fast, in some cases faster than C, and climate modeling, like most scientific computing, is about speed;
- Concurrency: performance requires concurrency, and Fortran did it before other languages knew what it was;
- Reusability: backward compatibility means that existing libraries can be easily reused;
- Arrays: Fortran treats arrays with due respect. It supports multidimensional arrays, many optimizations for array-based computations such as slicing, shrinking, reshaping, and vectorization;
- Longevity: Climate and other models cannot be implemented in languages that are (i) not backward compatible and (ii) constantly evolving. If you write code in Fortran today, it will probably still work in 20 or 30 years;
- Effort: Do you know how much effort it will take to redo the model? New languages pose a challenge;
- MPI: The Message Passing Interface (MPI) is the gateway to high-performance computing, and Fortran handles it very well.
Fortran is designed for scientific computing. Of course, Fortran is old, but so are Unix and C. Just because languages like Julia are newer doesn’t mean they’re better. Everyone thought that C++ would be some kind of coding savior, and look how it turned out. People sometimes think that if something is written in a language like R, it’s pure R…but they don’t realize that R itself isn’t pure R. R itself consists of code from R, C, and Fortran.
Source: Michael Wirt’s Bolg
Do you share Michael Wirth’s views on Fortran?
Have you ever used this language? What are his strengths and weaknesses?
Which one do you prefer over the Julia language?
Julia version 1.6 is available, which reduces compiler latency and eliminates unnecessary recompilations
Go 1.16 has been released and provides support for 64-bit ARM architecture on macOS, as well as integration of static files and file trees into the final executable.
C++ vs Rust: A practical comparison of the two programming languages’ compilation and testing speed by Software Engineer Matthew Glazar