HP Fortran Programmer's Guide (March 2010)

Performance and optimization
Vectorization
Chapter 6174
END DO
!*$* NOVECTORIZE
.
.
.
Note that the *$* VECTORIZE directive does not force vectorization. The optimizer vectorizes
only if:
The loop performs a vector operation recognized by the optimizer as in its repertoire.
The loop is safe to vectorize. The same conditions that can prevent parallelization—see,
for example, “Data dependences” on page 169—can also prevent vectorization.
The optimizer can discover no other transformations that can result in better
performance.
The only way to ensure vectorization is for the programmer to edit the source file and
substitute an appropriate call to the BLAS library for the loop, as described in “Controlling
vectorization locally” on page 173.
For a detailed description of the *$* [NO]VECTORIZE directive, see the HP Fortran
Programmer's Reference.
Calling BLAS library routines
The HP Fortran compiler is bundled with the Basic Linear Algebra Subroutine (BLAS)
library. This library consists of specially tuned routines that perform low-level vector and
matrix operations that conform to a de facto, industry-wide standard
1
. The BLAS routines
are widely available, making them portable across many implementations of Fortran.
HP Fortran includes a library of the BLAS routines that have been especially tuned for
performance on PA-RISC machines. You can call any of these routines in an
HP Fortran program by compiling it with the -lblas option.
Consider the following program, which contains a loop that performs an operation on two
arrays that is identical to the saxpy routine in the BLAS library, as noted in the comments:
Example 6-1 saxpy.f90
PROGRAM main
1. See the LAPACK User’s Guide, ed. J. Dongarra et al (Philadelphia, 1992). Each of
the BLAS routines has its own man page; see blas(3X) for an introduction. Also,
see the URL: http://www.netlib.org.