![](https://csdnimg.cn/release/download_crawler_static/10143204/bg12.jpg)
Revision B ADIFOR 2.0 User's Guide April 29, 1995
The name of the composition must end with a \.cmp" extension. The name of each source le must
end with a \.f " sux. Each source le listed in a composition may contain the source for one or more
FORTRAN 77 routines.
Since ADIFOR 2.0 uses interprocedural analysis to reduce the cost of computing derivatives, a compo-
sition must describ e a
complete
and
consistent
program. To b e
complete
, a program must not have missing
entry p oints, i.e., the program must link without undened external references. To b e
consistent
, all pro ce-
dure interfaces in the program must agree as to the number of arguments and the types of the arguments
being passed. Many programs in use today have inconsistent interfaces. Fixing the inconsistenci es may take
signicant eort, but is usually an enlightening process.
In addition to being complete and consistent, your program must not be recursive. ADIFOR 2.0 will
complain if it encounters a recursive program and will print out the names of each of the routines that are
recursive. Recursion in FORTRAN 77 programs is usually, but not always, an indication of some underlying
error.
When ADIFOR 2.0 generates derivative co de for a le
somedir/foo.f
, it places the generated source
code into a le
g
foo.f
in the sub directory identied by the option
AD OUTPUT DIR
of the directory in
which ADIFOR 2.0 was executed. Therefore, no two pathnames listed in a comp osition may have the
same basename, where the basename of
somedir/foo.f
is taken to be
foo.f
. ADIFOR 2.0 will complain if
multiple les in your program have the same basename.
In reality, it is necessary to submit to ADIFOR 2.0 only the p ortion of the program that denes the
function to be dierentiated. This usually requires that you create a
dummy main
procedure that invokes
the routines to be dierentiated (see Chapter 4).
3.3 Acceptable FORTRAN 77 Source Files
ADIFOR 2.0 recognizes standard FORTRAN 77 syntax extended with
DO-ENDDO
,
IMPLICIT NONE
,
DOUBLE
COMPLEX
, and
INCLUDE
. Variable names need not be limited to six characters. If a program uses non-
standard extensions, ADIFOR 2.0 will probably not accept them. In particular, ADIFOR 2.0 will not
accept nonstandard intrinsic or type conversion functions, such as
arsin()
,
arcos()
, and
dfloat()
. These
should be replaced with standard functions like
asin()
,
acos()
, and
dble()
. In any case, for p ortability
reasons, it is probably a go od idea anyway to make sure that all code is standard-conforming. Also not
accepted are system calls such as
etime()
. In most cases, such calls do not aect function evaluation and
may b e removed, commented out, or replaced with a syntactically correct but nonfunctional subroutine,
prior to pro cessing with ADIFOR 2.0.
We strongly urge you to make sure that all of the les in your comp osition compile correctly and adhere to
the FORTRAN 77 standard b efore submitting them to ADIFOR 2.0 for pro cessing. ADIFOR will complain
about syntax errors, but its error messages are likely to be more cryptic. ADIFOR 2.0 will also complain
about problems in your source code that the typical FORTRAN 77 compiler will fail to identify, sp ecically,
inconsistencies between callsites and the procedures they invoke, and inconsistencies between common block
declarations across pro cedures.
For example, in the following program fragment an
integer*4
array of length 3 is passed to a subroutine
whose arguments were declared to be of type
character*12
.
12