Intel® Fortran Compiler 16.0 User and Reference Guide

GAP Message (Diagnostic ID 30528)

Message

Add "%s" to the declaration of routine "%s" in order to parallelize the loop at line %d. Adding "%s" achieves a similar effect.

Advice

Confirm that the routine specified is indeed an elemental function or an ATTRIBUTES CONCURRENCY_SAFE function before following the advice to add the annotation.

If the routine is not one of these kinds of functions, try to inline it with a FORCEINLINE RECURSIVE directive. This action may or may not be beneficial.

Example

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 foo

In 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

Verify

Confirm that the routine satisfies the semantics of this declaration. Another way to help the loop being parallelized is to inline the routine with the FORCEINLINE RECURSIVE directive, but this method does not guarantee parallelization.

See Also