Convert to Fortran SIMD-enabled functions

Passing an array/array recommendation to an ELEMENTAL function/subroutine is creating a dependency that prevents vectorization. To fix:

Example (original code)

elemental subroutine callee(t,q,r)
    ...
end subroutine callee
...
do k = 1,nlev
    call callee(a(:,k), b(:,k), c(:,k))
...
elemental subroutine callee(t,q,r)
    real, intent(in) :: t, q
    real, intent(out) :: r
    r = t + q
end subroutine callee
...
do k = 1,nlev
    call callee(a(:,k), b(:,k), c(:,k))
end do
... 

Example (revised code)

subroutine callee(t,q,r)
    !$OMP DECLARE SIMD(callee)
    ...
end subroutine callee
...
do k = 1,nlev
    !$OMP SIMD
    do i = 1,n
        call callee(a(i,k), b(i,k), c(i,k))
...
subroutine callee(t,q,r)
    !$OMP DECLARE SIMD(callee)
    real, intent(in) :: t, q
    real, intent(out) :: r
    r = t + q
end subroutine callee
...
do k = 1,nlev
    !$OMP SIMD
    do i = 1,n
        call callee(a(i,k), b(i,k), c(i,k))
    end do
end do
... 

Read More