The -routine
switch allows you to specify switches
that apply only to specific routines within the source file KAP
processes. The only switches that -routine
can specify
are as follows:
-each_invariant_if_growth
-max_invariant_if_growth
-optimize
-roundoff
-scalaropt
-skip
-unroll
-unroll2
-unroll3
The syntax of a KAP command using the -routine
switch
requires that
-routine
and the switches it specifies come at the
end of the command line after the Digital Fortran source file, for
example:
kapf [-<switches>] source_file.f \ -routine=<routine_name>[,<routine_name>...]<switches_for_routine_names> ...
-routine
switch and the switches it specifies are not at the end of the
command line after the source file, KAP generates the following
error message:
Command line error -- An input file has not been specified on the command line. KAP -- Command Line Syntax Error Detected.
The <routine_name>
argument must be a routine in
source_file.f.
You can specify switches that apply to
all routines in the source file after kapf
. Finally,
switches for each instance of <routine_name>
must come
from the preceding bulleted list.
For example, consider the following command line:
kapf -scalaropt program.f -routine=sub_1 -roundoff
-optimize
This command invokes KAP and passes the -scalaropt
switch to all program units in file program.f
(including sub_1
). Program unit sub_
1
processes with both the -roundoff
and
-optimize
switches.
Using the -routine
switch implies that directives
equivalent to the specified switches are asserted only while
processing particular routines. The effect is the same as if the
implied directives were inserted at the top of the associated
routines.
Using the -routine
switch makes the resulting
kapf
command contain two halves. The first half
looks like any other kapf
command because it contains
kapf
, switches different from -routine
,
and a source file name. The second half of the command is different
because it contains one or more -routine
switches, each
with associated routines and switches for the routines selected from
the preceding bulleted list.
For example, consider the following command line:
kapf -cachesize=8,0 -syntax=a my_program.f -
-routine=sub_1,sub_2,sub_3 -roundoff -optimize -routine=sub_4
-unroll
An explanation of the two halves follows:
kapf
and passes the
-cachesize=8,0
and -syntax=a
switches
to all program units in file my_program.f.
The
program units include sub_1, sub_2, sub_3,
and
sub_4
.
sub_1, sub_2, and sub_3
process with both the -roundoff
and
-optimize
switches. Routine -sub_4
processes with the -unroll
switch.
The usual rules for shortening the names of switches also apply to
the -routine
switch. For example, the following KAP
command fragments produce identical results:
-routine=subroutine_a -optimize -unroll
-routine=subroutine_a -opt -unr