Your application calls scalar instead of vectorized versions of math functions. To fix: Do all of the following:
- Use the -mveclibabi=svml compiler option to specify the Intel short vector math library ABI type for vector instrinsics.
- Use the -ftree-vectorize and -funsafe-math-optimizations compiler options to enable vector math functions.
- Use the -L/path/to/intel/lib and -lsvml compiler options to specify an SVML ABI-compatible library at link time.
gfortran PROGRAM.FOR -O2 -ftree-vectorize -funsafe-math-optimizations -mveclibabi=svml -L/opt/intel/lib/intel64 -lm -lsvml -Wl,-rpath=/opt/intel/lib/intel64gfortran PROGRAM.FOR -O2 -ftree-vectorize -funsafe-math-optimizations -mveclibabi=svml -L/opt/intel/lib/intel64 -lm -lsvml -Wl,-rpath=/opt/intel/lib/intel64program main
parameter (N=100000000)
real*8 angles(N), results(N)
integer i
call srand(86456)
do i=1,N
angles(i) = rand()
enddo
! the loop will be auto-vectorized
do i=1,N
results(i) = cos(angles(i))
enddo
end