Math 6395 -- Introduction to Parallel Scientific Computing

Fortran 90/95


[back to top]

[adapted from Wikipedia and the article "Why Fortran?" (link below)]

Among many computer scientists, fortran is an f-word. yet, it's still the most widely used language in scientific computing, especially when high performance is required.

Fortran is a general-purpose, procedural, imperative programming language that is especially suited to numeric computation and scientific computing. Originally developed by IBM in the 1950s for scientific and engineering applications, Fortran came to dominate this area of programming early on and has been in continual use for over half a century in computationally intensive areas such as numerical weather prediction, finite element analysis, computational fluid dynamics (CFD), computational physics, and computational chemistry. It is one of the most popular languages in the area of High-performance computing and programs to benchmark and rank the world's fastest supercomputers are written in Fortran.

Fortran (a blend word derived from The IBM Mathematical Formula Translating System) encompasses a lineage of versions, each of which evolved to add extensions to the language while usually retaining compatibility with previous versions. Successive versions have added support for processing of character-based data (FORTRAN 77), array programming, module-based programming and object-based programming (Fortran 90/95), and object-oriented and generic programming (Fortran 2003).

One reason developers write new scientific applications in Fortran90/95 is that it's a natural language for expressing science and engineering ideas. Fortran90/95 support most C++ or Java features with the notable exceptions of inheritance and dynamic polymorphism. In fact, Fortran90/95 arrays act like objects that contain information about size, dimension, and stride; array syntax permits powerful and expressive operations on these "objects." Pointers support complex structures such as linked lists, but alternatives such as allocatable and automatic arrays are available for simple access to dynamic memory. The developer can create classes with the module construct, which strictly enforces type-checking and encapsulation. All types are then resolved at compile time -- runtime typing errors can't occur, so the debugging process speeds up. In short, Fortran95 isn't your grandmother's FORTRAN!

A second reason for the scientific community's preference for Fortran is performance. Fortran compilers are very mature. Many compiler optimization techniques rely on safely reordering instructions to take advantage of processor features. A rather simple, primitive language by today's standards, Fortran77 is relatively easy for compilers to analyze. All array addressing in Fortran77 occurs via array indices; in languages such as C, direct pointer arithmetic and the possibility that different arguments can refer to the same location (pointer aliasing) greatly complicate code analysis for compilers. As a result, safe code reordering is much easier to determine in Fortran77. (This isn't to say that optimized code isn't possible in other languages, but you must be much more of an expert to write it.)


As mentioned in the syllabus, you may use any language out of the set {Fortran77, Fortran90/95, C, C++} in this course. For those students who know none of these, I recommend Fortran 90/95, and I recommend the book Fortran 95/2003 Explained, by Michael Metcalf, John K. Reid & Malcolm Cohen, Oxford University Press, 2004. For those students who prefer electronic reference materials (or do not wish to spend money on books), I provide the following links.

Fortran Links: