**1. NAME AND TITLE**

GRESS 3.0: Gradient Enhanced Software System.

**2. CONTRIBUTOR**

Oak Ridge National Laboratory, Oak Ridge, Tennessee.

**3. CODING LANGUAGE AND COMPUTER**

Fortran 77 and C; VAX, IBM RISC 6000, SUN Sparc 1+, DEC Alpha, and HP 9000.

**4. NATURE OF PROBLEM SOLVED**

The GRESS Fortran precompiler (SYMG) and run-time library are used to enhance conventional Fortran 77 programs with analytic differentiation of arithmetic statements for automatic differentiation in either forward or reverse mode. GRESS 3.0 is functionally equivalent to GRESS 2.1. GRESS 2.1 is an improved and updated version of the previously released GRESS 1.1. Improvements in the implementation of the CHAIN option have resulted in a 70 to 85% reduction in execution time and up to a 50% reduction in memory required for forward chaining applications.

**5. METHOD OF SOLUTION**

GRESS uses a precompiler to analyze Fortran statements and determine the mathematical operations embodied in them. As each arithmetic assignment statement in a program is analyzed, SYMG generates the partial derivatives of the term on the left with respect to each floating-point variable on the right. The result of the precompilation step is a new Fortran program that can produce derivatives for any REAL (i.e., single or double precision) variable calculated by the model. Consequently, GRESS enhances Fortran programs or subprograms by adding the calculation of derivatives along with the original output. Derivatives from a GRESS enhanced model can be used internally (e.g., iteration acceleration) or externally (e.g., sensitivity studies). By calling GRESS run-time routines, derivatives can be propagated through the code via the chain rule (referred to as the CHAIN option) or accumulated to create an adjoint matrix (referred to as the ADGEN option). A third option, GENSUB, makes it possible to process a subset of a program (i.e., a do loop, subroutine, function, a sequence of subroutines, or a whole program) for calculating derivatives of dependent variables with respect to independent variables. A code enhanced with the GENSUB option can use forward mode, reverse mode, or a hybrid of the two modes.

**6. RESTRICTIONS OR LIMITATIONS**

GRESS accepts a majority of ANSI X3.9-1978 standard Fortran 77. Restrictions and limitations are discussed in the GRESS User's Manual. Users should also refer to the README.1ST file on the distribution diskette and to the additional restrictions and comments mentioned here. GRESS/SYMG will require significant modifications to implement on non-ASCII computers. Function sub-programs must define the return value of the function immediately before the return statement.

**7. TYPICAL RUNNING TIME**

Execution times for both precompiler and enhanced application programs are problem dependent. Running time for application programs will increase significantly after enhancement. On a VAX 8600 computer, the precompiler will process an application Fortran program at a rate of approximately 1000 lines of code per 4 seconds of CPU time.

**8. COMPUTER HARDWARE REQUIREMENTS**

GRESS 3.0 is operable on VAX, HP 9000, IBM/AIX, DEC Alpha, and SUN computers. Storing an adjoint matrix requires a direct access storage device. (Users have reported implementing the SUN version on an IRIS without requiring any modifications to the software.)

**9. COMPUTER SOFTWARE REQUIREMENTS**

Fortran 77 and C compilers are required under the VMS or UNIX operating systems. Both VMS and ULTRIX versions are included for VAX computers. On DEC Alpha GRESS was installed under the OSF1 Operating System.

**10. REFERENCES**

Included in package:

J. E. Horwedel, "GRESS Version 2.0 User's Manual," ORNL/TM-11951 (November 1991).

Oblow, E. M., "An Automated Procedure for Sensitivity Analysis Using Computer Calculus," ORNL/TM-8776 (May 1983).

Worley, B.A., Pin, F.G., Horwedel, J.E., and Oblow, E.M., "ADGEN - ADjoint GENerator for Computer Models," ORNL/TM-11037 (May 1989).

Horwedel, J. E., "Matrix Reduction Algorithms for GRESS and ADGEN," ORNL/TM-11261 (November 1989).

Horwedel, J.E., "Reverse Automatic Differentiation of Modular FORTRAN Programs," ORNL/TM-12050 (March 1992).

Background Information:

Horwedel, J. E., Raridon, R. J., and Wright, R.Q., "Sensitivity Analysis of AIRDOS-EPA Using ADGEN with Matrix Reduction Algorithms," ORNL/TM-11373 (1989).

Horwedel, J. E., Wright, R. Q., and Maerker, R. E., "Sensitivity Analysis of EQ3," ORNL/TM-11407 (1990).

Horwedel, J.E., "GRESS, A Preprocessor for Sensitivity Studies of Fortran Programs," Proc. of SIAM Workshop of Automatic Differentiation of Algorithms: Theory, Implementation, and Application, Breckenridge, Colorado, January 6-8, 1991, p. 243-250 (1991).

Horwedel, J. E., Raridon, R. J., and Wright, R.Q., "Automated Sensitivity Analysis of an Atmospheric Dispersion Model," Atmospheric Environment Vol 26A, No. 9, pp. 1643-1649, (1992) (printed in Great Britain).

Oblow, E. M., Pin, F. G., and Wright, R. Q., "Sensitivity Analysis Using Computer Calculus:
A Nuclear Waste Application," *Nucl. Sci. Eng. 94, 46* (1986).

Worley, B. A., Wright, R. Q., Pin, F. G., and Harper, W. V., "Application of an Automated
Procedure for Adding a Comprehensive Sensitivity Calculation Capability to the ORIGEN2 Point
Depletion and Radioactivity Decay Code, *Nucl. Sci. Eng. 94, 180 * (1986).

Worley, B. A., "Experience with the Forward and Reverse Mode of GRESS in Contaminant Transport Modeling and Other Applications, Proc. of SIAM Workshop on Automatic Differentiation of Algorithms: Theory, Implementation, and Application, Breckenridge, Colorado, January 6-8, 1991. p. 307-314 (1991).

Corliss, G. F., Griewand, A. (ed.), "Automatic Differentiation of Algorithms: Theory, Implementation, and Application, Breckenridge, Colorado, January 6-8, 1991. (1991).

**11. CONTENTS OF CODE PACKAGE**

Included are the referenced document and the information files (README.1st), GRESS source files, several sample problems, and sample output. The package is transmitted on one DS/HD 5.25-in. (1.2 MB) diskette in a self-extracting compressed DOS file. It is alternately available in tar format on any of the following media: one DS/HD 3.5-in (1.44 MB) diskette or on either DC 6150 (150 MB), 4 mm DAT (8 GB), or 8 mm (2.3 GB) cartridge tape.

**12. DATE OF ABSTRACT**

October 1988, revised June 1989, April 1990, September 1990, March 1991, and December 1991, April 1993, and March 1994.

**KEYWORDS: ** SENSITIVITY ANALYSIS; WORKSTATION; AUTOMATIC DIFFERENTIATION; COMPUTATIONAL DIFFERENTIATION.