Product Version: Intel(R) Visual Fortran Compiler XE 15.0.0.070
Cause:
The vectorization report generated when using Visual Fortran Compiler's optimization options ( -O2 -Qopt-report:2 ) states that loop was not vectorized since loop with function call cannot be vectorized.
Example:
An example below will generate the following remark in optimization report:
subroutine bar(a) implicit none include 'omp_lib.h' integer (kind=omp_lock_kind) a call omp_init_lock(a) end subroutine bar subroutine foo(a,n) include 'omp_lib.h' integer (kind=omp_lock_kind) a(n) do i=1,n call bar (a(i)) end do end subroutine foo
Report from: Loop nest, Vector & Auto-parallelization optimizations [loop, vec, par]
LOOP BEGIN at f15527.f90(13,8)
f15527.f90(6,10):remark #15527: loop was not vectorized: function call to _omp_init_lock cannot be vectorized
LOOP END
Resolution:
In order for the loop to be vectorized there should be no special operators and no function or subroutine calls, unless these are inlined, either manually or automatically by the compiler, or they are SIMD (vectorized) functions.
See also:
Requirements for Vectorizable Loops
Vectorization and Optimization Reports