For a detailed description of the *$* [NO]VECTORIZE directive, see the HP Fortran Programmer's Reference.
NOTE: The + Ovectorizeoption is valid only on the
The HP Fortran compiler is bundled with the Basic Linear Algebra Subroutine (BLAS) library. This library consists of specially tuned routines that perform
HP Fortran includes a library of the BLAS routines that have been especially tuned for performance on
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 19 Example
Example
PROGRAM main
INTEGER :: i, inc_x, inc_y, dim_num
REAL, DIMENSION(5) :: x, y
REAL :: b
b = 3.0 dim_num = 5
inc_x = 1 inc_y = 1
!initialize the two arrays x and y DO i = 1, 5
y(i) = i
x(i) = i + 3.0
END DO PRINT *, y
!add a scalar multiple of x to y DO i = 1, 5
y(i) = y(i) + b * x(i)
END DO PRINT *, y
END PROGRAM main
The following command lines compile and execute the program, and show the output from a sample run:
$ f90 saxpy.f90 $ a.out
1.02.0 3.0 4.0 5.0
13.017.0 21.0 25.0 29.0
If you call a BLAS routine that is a function, be sure to declare the return value of the routine in a data declaration statement and specify the EXTERNALattribute, as in the following:
REAL, EXTERNAL :: sdot
Fortran uses implicit typing by default. Unless a function is explicitly declared as having a certain type, the type is determined by the first character of the BLAS routine. If that character implies a type other than that of the returned value, the result will be meaningless.
See the HP Fortran Programmer's Referencefor information about the BLAS library.
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.
Vectorization 105