HP Fortran Programmer's Guide (September 2007)
Performance and optimization
Parallelizing HP Fortran programs
Chapter 6 155
Profiling parallelized programs
You can profile a program that has been compiled for parallel execution in much the same way
as for non-parallel programs:
1. Compile the program with the +gprof option.
2. Run the program to produce profiling data.
3. Run gprof against the program.
4. View the output from gprof.
The differences are:
• Step 2 produces a gmon.out file with the CPU times for all executing threads.
• In Step 4, the flat profile that you view uses the following notation to denote DO loops that
were parallelized:
routine_name
##pr_line_
nnnn
where
routine_name
is the name of the routine containing the loop, pr (parallel region)
indicates that the loop was parallelized, and
nnnn
is the line number of the start of the
loop.
Conditions inhibiting loop parallelization
The following sections describe conditions that can cause the compiler not to parallelize.
These include the following:
• Calling routines with side effects
• Indeterminate iteration counts
• Data dependences
Calling routines with side effects
The compiler will not parallelize any loop containing a call to a routine that has side effects. A
routine has side effects if it does any of the following:
• Modifies its arguments
• Modifies a global, common-block variable, or save variable
• Redefines variables that are local to the calling routine
• Performs I/O
• Calls another subroutine or function that does any of the above