Fortran 2000 evolves to meet challenge of large scale numeric applications

London 03 August 2001 The British Standards Institute (BSI) played host to the ISO working party (WG5) which is busy trying to interpret Fortran 95 queries and review the draft document of the Fortran 2000 standard. Fortran is an evolving modern programming language. The latest draft standard incorporates many of the best features from other languages, but remains faithful to its original highly efficient role which made it the dominant numerical scientific and engineering programming language to-date, and at the same time it ensures protection of the vast programming investment in Fortran software. (Chris Lazou)

London 30 July - 3 August: The British Standards Institute (BSI) played host to the ISO working party (WG5) which is busy trying to interpret Fortran 95 queries and review the draft document of the Fortran 2000 standard. These unsung mostly volunteer heroes come from many countries as representatives of their national standards member body; e.g. BSI for the UK, NNI for the Netherlands, DIN for Germany, AFNOR for France and ANSI for the USA Although the standardisation process is driven by WG5, the technical development is subcontracted to J3 a Fortran committee of ANSI.

Language standardisation is a long and arduous job often taking 5 to 10 years to complete. The Fortran 2000 standard, the fifth of its kind, is chugging along nicely, but will take another year before it is made available for public comment. For example, every sentence in the 450 pages document describing the new standard has to be scrutinised for any ambiguity or side effects. I spent Monday afternoon listening to their discussions and the evening talking with them at a reception and discovered that the new language features are defined and technically proven. So, I feel a preview of what is in the standard is now appropriate.

During the reception I asked what is in this standard which would benefit the scientific and engineering computing user community. I was emphatically told that for numerical computation Fortran is in a class of it own, unrivalled by any other programming language. It is universally available, portable, simple, easy to use and efficient.

I went on to say but most people think of Fortran as an old very limited language with so few facilities that it is irrelevant and a handicap to modern computing. The response was forthright and derisory. "Those people who make these ridiculous statements have failed to take onboard the modernising efforts delivered in the Fortran 90 standard. They are stuck in the 1960's and 1970's vision of Fortran".

I persisted and pointed out that even Fortran 95 is mainly addressing share memory systems, has no object oriented programming constructs, no graphic user interface, exception handling or IEEE arithmetic.

The reply was again emphatic. "All these constructs were familiar to the standards people, but because a standard aims to encapsulate best practice and requires agreement by a diverse constituency it was not possible to include these new constructs earlier. These constructs are not only included in the new Fortran 2000 standard, but the lessons of for example, poor efficiency of C++ have been learned. Fortran 2000 OOP constructs for example, can be implemented preserving the efficiency of Fortran programs".

The next question I posed is whether there would be any users by the time Fortran 2000 becomes available.

The response was that: "For 45 years Fortran has been synonymous with scientific and engineering computation. [HPCwire "Pioneers of the Fortran programming language", 15 June 2001]. Early computers were designed with a strong emphasis on numerical calculations. Later supercomputers were essentially Fortran engines. At present more than 80% of scientific computation uses Fortran and Fortran libraries from third party vendors. There are some places which are migrating. For example, JPL has initiated a project to rewrite their suite of 60 programs consisting of some six million lines of Fortran 77 code to C++. The rationale was that the C++ version would be much easier to maintain so the cost of some 120 programming years was worth it. After some 40 programming years expended the estimate is still another 120 programming years to go. Also there is anecdotal evidence, that C++ programs are less efficient. For example, the Los Alamos people converted some of their nuclear codes and discovered at the end of this expensive activity that the efficiency of their C++ version was only 40% of the original Fortran code". (Note that the situation may have improved since last year when I heard their presentation).

One has to appreciate that standards become necessary and inevitable once an industry takes root. It is a measure of its maturity and without standards, its stability and long-term growth could not be sustained. The main aim of the standardisation process is to codify the best of existing practice, opening the market up and stimulating multi-vendor competition. This in turn provides a wider choice for the consumer. Fortran was first standardised in 1966.

Fortran 90 and beyond.

"I am not certain what the language for scientific and engineering computation will look like by the 21st century, but I am sure it will be called Fortran."

This anecdotal statement became common currency in the late 1980's when the future of Fortran 90 standard was hotly debated.

When finished, the Fortran 90 standard produced a modern language with no rival in its application domain. It reached its goal of preserving reliability and portability, and in addition in modernising Fortran so that it may continue its long history as a scientific and engineering programming language. The vast programming investment in software packages was therefore protected and this ensured the survival of Fortran to-date. Fortran has withstood the test of time because over the years it has modernised in a controlled fashion, remained simple, portable, easy to use, and efficient. The concept of language evolution is enshrined in the standardisation process.

Fortran 90 contains many new constructs. It incorporates modern programming techniques into Fortran, such as, free format source form, array operations, improved numeric precision and computation, programmer-defined data types, a modular data concept, pointers, new control structures, dynamic association, bit manipulation, stream I/O, varying length strings, detection of non-standard features, and language evolution via the concept of obsolescent and deprecated features.

Fortran 90 includes both data and process parallelism, but this is entirely implicit. Data parallelism is achieved primarily from the conceptual parallelism of array operations; process parallelism is implicit in the general way expressions are evaluated, (for example, operands can be evaluated in parallel). Despite these forms of parallelism, Fortran 90 is not specifically oriented towards parallel computation. It is more concerned with shared memory vector processing than multi-processor parallel systems. Most Fortran programs were developed under a sequential regime with little regard to the rigours necessary for ensuring that they executed in parallel without any data dependent side-effects. The advent of computers with multiple processor units and distributed memory changed all that.

High Performance Fortran (HPF).

In the nineties distributed memory parallel architectures took a hold and were seen as the only way to deliver higher levels of performance. Experience, however, shows that they are extremely difficult to program effectively. Fortran programmers dealing with scientific applications need to manipulate large data structures in the form of grids and their associated matrices. The difficulty arises because each of the large number of processors of current distributed memory computers has a limited amount of local memory. The need to address this culminated in the design of HPF. It is an industry-wide "ad hoc standard" language designed as directives and extensions to Fortran to enable programmers to map algorithms onto machines with parallel processors, parallel memory, or both.

HPF aims to achieve efficient portable code across a variety of parallel machines. Otherwise, the programmer's effort to get high performance would be wasted when the same program is ported to another machine. HPF extends Fortran 90 to include data distribution and data parallel execution features. It provides extended intrinsic functions, extrinsic procedures and allows changes in sequences and storage association.

As it turned out HPF failed to deliver efficiently and MPI took over the mantle for handling distributed parallel programming. OpenMP is doing the same for the Shared Memory Parallel systems.

The Fortran 95 standard.

The current ISO Fortran 95 standard, has only minor changes from Fortran 90. It took onboard some HPF features, such as the FORALL statement, but not all. This was because some of the features in HPF were judged to be of transient nature and not expected to survive the changes in machine architectures.

New user requirements become apparent.

Advances in chip technology have made modest parallel processing a common feature of computing. This trend poses a challenge to the evolution of procedural languages such as Fortran and C. This involves not only the definition of parallel syntax and constructs for using parallel computers, but also how to handle errors effectively for time consuming large applications. For example, a Large Eddy Simulation, (LES), on 3D-Aircraft requires 10Tflop/s, 30Gigawords of memory and the results require 9Tbytes of disk space. Even with this resources available it could take 10 hours to complete a computation. Any failure which requires a restart of the computation could seriously impair work schedules.

Large amounts of computing resources are also needed in many other applications: e.g. fluid flows, turbulence, acoustic system integration, Ab Initio in chemistry, safety analysis, environmental pollution, climate simulations and other time critical large problems.

In the nineties scientists and engineers started to use computers not only for simulation purposes, but to provide complete solutions for product development. For example, aircraft manufacturers now design, simulate performance and go direct into production of aircraft, eliminating the building of scaled down models and the costly testing in wind tunnels. To achieve this the computing results must be accurate and the computer runs must not be hampered by runtime errors either by some processor failing or some software deficiency. Thus both derived data type extensions to eliminate current shortcomings, and exception handling to allow user control of any runtime failures are becoming crucial requirements if Fortran is to remain useful.

Another area which can help users is a standard interface between Fortran and C. This is because a significant fraction of computing environments come with a C (API). Examples include X-windows libraries, Motif, TCP/IP socket calls and interfaces to system routines. The Fortran programmer is currently unable to exploit this wealth of software in a portable manner. This causes many problems for those who wish to front-end a powerful scientific visualisation package, written in Fortran, with a sophisticated graphical user interface, (GUI).

The draft Fortran 2000 standard.

The working draft Fortran 2000 standard (June 2001), contains several extensions to Fortran 95 addressing these new requirements. Among them are:

"Derived type enhancements (parameterised derived types, mixed component accessibility, public entities of private types, ASSOCIATE construct, generalised constructors, and finalizers);

Object Oriented Programming (extensible types, inheritance, polymorphism, dynamic type allocation, and type-bound procedures);

Data manipulation enhancements (which include allocatable components, deferred type parameters, VOLATILE attribute, and so on);

Input/Output enhancements (asynchronous, stream and user-defined derived-type I/O, control of rounding during format conversion, named scratch files, and named constants for standard-defined units and status values);

Procedure pointers and abstract interfaces; scoping enhancements (renaming of defined operators and control of host association into interface bodies);

Support for exceptions and IEEE arithmetic;

Interoperability with the C programming language;

Support for cultural adaptability; and miscellaneous enhancements (command line arguments, environment variables, increased statement length, and access to error message text)".

The bottom line

In summary, Fortran is an evolving modern programming language. The latest draft standard incorporates many of the best features from other languages, but remains faithful to its original highly efficient role which made it the dominant numerical scientific and engineering programming language to-date, and at the same time it ensures protection of the vast programming investment in Fortran software.

These developments will not only provide benefits to existing users but in my view, they will also offer familiar facilities to non-Fortran users such as financial institutions, to undertake simulations of financial markets and other mission critical applications.

The draft Fortran 2000 standard is presently undergoing fine-tuning, before release for public comment in about a year from now.

For those of you who wish to influence the final content you should talk to your national standards representative or make your views known during the public comment period.

[Lazou chairs the British Computer Society Fortran Specialist Group]


Chris Lazou

[News on Advanced IT]   [Calendar]   [Analysis]   [IT in Medicine]