HP Fortran Programmer's Guide (B3908-90031; September 2011)

Performance and optimization
Parallelizing HP Fortran programs
Chapter 6164
Parallelizing HP Fortran programs
The following sections discuss how to use the +Oparallel option and the parallel directives when
preparing and compiling HP Fortran programs for parallel execution. Later sections also discuss reasons
why the compiler may not have performed parallelization. The last section describes runtime warning and
error messages unique to parallel-executing programs.
For a description of the +Oparallel option, see “Fine-tuning optimization options” on page 62.
NOTE The +Oparallel option is not available on Integrity systems for HP Fortran Version 3.2
and later. You must use the +Oautopar option instead to parallelize loops.
Compiling for parallel execution
The following command lines compile (without linking) three source files: x.f90, y.f90, and z.f90. The
files x.f90 and y.f90 are compiled for parallel execution. The file z.f90 is compiled for serial execution,
even though its object file will be linked with x.o and y.o.
f90 +O3 +Oparallel -c x.f90 y.f90
f90 +O3 -c z.f90
The following command line links the three object files, producing the executable file para_prog:
f90 +O3 +Oparallel -o para_prog x.o y.o z.o
As this command line implies, if you link and compile separately, you must use f90, not ld. The command
line to link must also include the +Oparallel and +O3 options in order to link in the parallel runtime
support.
Performance and parallelization
To ensure the best runtime performance from programs compiled for parallel execution on a multiprocessor
machine, do not run more than one parallel program on a multiprocessor machine at the same time. Running
two or more parallel programs simultaneously may result in their sharing the same processors, which will
degrade performance. You should run a parallel-executing program at a higher priority than any other user
program; see rtprio(1) for information about setting real-time priorities.
Running a parallel program on a heavily loaded system may also slow performance.