apogee-software apogee compilers c & c++ & fortran 77 & fortran 90 User Manual

Page of 223
Apogee User’s Manual  Page 173
Appendix B
A 5-Minute KAP Guide
Introduction
This brief appendix could be subtitled
Getting the Most Improvement from KAP in the Shortest Time
.
The target audience is KAP users who want to begin using KAP quickly.  This is a generic
document that can be used with both the C and FORTRAN versions of KAP.  It provides
separate protocols for small and large programs.  Small programs are defined as those which
have a small number of program units and which can be compiled and run quickly.  Since the
cost of each iteration is small, you can take risks.  Large programs are defined as those which
take more time to compile and run than it takes for you to check the results.  A program can be
large either because the source code is very large or because the execution time is long.
For details on any or all available KAP usage, see the appropriate KAP manual.  Often simply
turning on KAP (ie, adding
-Xkap
 to the command line) works well,particularly on Fortran.
Optimizing Small Programs with KAP
1) Compile the program without KAP, with "typical" compiler optimization (say,
-fast
or
-O
).  Note the execution time and verify the results.  (If the program fails at this step,
you must resolve the problem before using KAP.  You can try to isolate the problem,
correct it, and proceed.  This may not be feasible for handling problems in large
programs, but it might work for isolated portability problems.)
Once the program is successfully running, rebuild it with KAP enabled (for example,
using the options:
-fast -Xkap
 or
-O -Xkap
).
Appendix B