Intel® Fortran Compiler 16.0 User and Reference Guide
To parallelize the loop at line %d, annotate the routine %s with %s.
If the loop contains a call to a function, the compiler cannot parallelize the loop without more information about the function being called.
However, if the function being called in the loop is an elemental function or a function specified with ATTRIBUTES CONCURRENCY_SAFE, then the call does not inhibit parallelization of the loop.
Consider the following:
subroutine foo () integer, parameter :: N2 = 10000 real (8) :: A(N2), B(N2) interface function bar (k) integer :: bar, k end function bar end interface integer :: i do i =1, N2 A(i) = B(i) * bar(N2) end do end subroutine fooIn this case, to parallelize the loop at line 11, declare the routine bar as elemental.
If you determine it is safe to do so, an alternative way you can modify the program code is as follows:
subroutine foo () integer, parameter :: N2 = 10000 real (8) :: A(N2), B(N2) interface function bar (k) !dir$ attributes concurrency_safe : profitable integer :: bar, k end function bar end interface integer :: i do i =1, N2 A(i) = B(i) * bar(N2) end do end subroutine foo
Consider the following:
Confirm the routine satisfies the semantics of this annotation. A weaker annotation able to achieve a similar effect is ATTRIBUTES CONCURRENCY_SAFE(PROFITABLE).