You are here

Design Recovery Driven Porting and Refactoring of Fortran 77 Codes for Performance, Sustainability, and Consistency

Description:

NIST has a substantial code base written in Fortran 77 that will become very difficult to maintain as the generation of original developers retires; this issue was highlighted during the massive drive to update enterprise software systems to address the Y2K problem and will manifest itself again when the Unix “epoch” will reach its 32-bit limit in 2038. As such, there is a need for a tool that assists developers in modernizing this code base by (1) porting it to a more modern version of the language (e.g., Fortran 2008) or an altogether different language (e.g., C++), and transforming the code into a system that is documented, maintainable, and with a far better performance. This task is simply too onerous to achieve manually without tool support if the system at hand exceeds a few thousand lines of code. Furthermore, this need is not unique to NIST, but is rather universal across many federal agencies and national labs.

The project should develop a new tool or extend an existing tool that will assist developers in modernizing Fortran 77 systems and port them to more modern versions of the language (e.g., Fortran 2003 or 2008) or to a completely unrelated programming language such as C++. It is important to note that this is not a purely syntactic translation and will serve to reveal the underlying algorithms and data structures, document them, and potentially replace them by alternatives that are functionally equivalent, but deliver higher performance because they have lower runtime complexity or can take advantage of hardware parallelism that is available in modern computing platforms. Furthermore, the infrastructure embedded in the tool can be used to provide novel functionalities such as annotating a program’s source code to augment quantities with units (as in SI units) and evaluating the consistency of a program’s use of units.

At a minimum, the tool should provide the following functionality:

• Identify idioms of the language (common blocks, GOTO statements, poorly specified prototypes…) that impede sustainability and to replace them with more appropriate programming constructs. This should happen under the guidance of the developer who will specify the idioms to identify and how they will be replaced in the target language.

• Identify “dead code”.

• Support developers as they identify pieces of code that they want to refactor into separate routines. In doing so, the tool should automate many of the syntactic tasks that are associated with this refactoring (e.g., define prototype of new routine, declare variables in the new routine, and remove unneeded declarations from the calling routine, and format the source code of the new routine).

• Identify code sections that were replicated via “cut-and-paste” operations or that differ by simple changes in variable names.

• Allow developers to document code via text and Boolean expressions that can be evaluated at compile time or even during runtime.

• Keep track of all transformations implemented by developers so they can replay them in full or selectively to regenerate the “new” version of the system or to generate a different version of the system that is targeted at a new platform.

• Analyze the transformations put in place by developers to keep track of dependencies between these transformations. This will allow the tool to notify developers that they are introducing transformations that will break existing assumptions or prevent other transformations from being applied.

• Instrument the code to identify computational bottlenecks so developers can reengineer the code to reveal the underlying algorithms and data structures and, if possible, replace them by alternatives with the same functionality, but with better performance characteristics.

Phase I expected results:
The first phase should develop an architecture for the tool along with an implementation that provides a first set of functionalities. This first phase will be tested on a small system (e.g., 1–10,000 lines of Fortran 77 code).

Phase II expected results:
The second phase should provide an implementation with a complete set of functionalities. The tool will be tested on systems consisting of 10–100,000 lines of code. It will allow a “learned” developer to modernize a system consisting of 10–50,000 lines of code in a matter of weeks instead of months or years.

NIST may be available to consult with the awardee, discuss the problem and potential solutions, and evaluate the proposed implementations.

US Flag An Official Website of the United States Government