prof
The profprofiler can also be used for profiling. Unlike the gprofprofiler, prof does not generate the call graph profile. To use prof, do the following:
1.Compile the program with the +prof option. For example: $ f90
2.Run the program. This creates a file named mon.out in the current directory. For example: $ prog$ ls mon.outmon.out
3.Run prof, giving the name of the program as an argument, as follows: $ prof prog
profproduces a listing on standard output showing the time spent in each routine.
For more information about prof, see the prof((1))man page.
Using options to control optimization
HPFortranincludes a rich set of
The following sections describe how to use the
Using +O to set optimization levels
HP Fortran provides four levels of optimization. Each higher level is a superset of the lower levels; level 4 is the highest level and can result in a significant increase in program performance. Level 2 is the default level of optimization.
You invoke optimization by compiling with the
$ f90 +O4 file.f90
You can invoke level 2 (the default level) by specifying the
NOTE: You can debug programs optimized up to level 2. To prepare an optimized program for debugging, use the command line:
$ f90
Table 27 Optimization levels
| Optimizations |
|
|
|
Option | performed | Advantages | Disadvantages | Recommended use |
|
|
|
|
|
+O0default | Constant folding and | Compiles fastest; | Does very little | During program development. |
| partial evaluation of | compatible with the | optimization. |
|
| test conditions. | debugger option |
|
|
|
|
|
|
|
+O1 | Level 0 | Produces faster | Compiles slower | During program development. |
| optimizations, plus | programs than level 0; | than level 0. |
|
|
|
|
|
|
90 Performance and optimization