Intel® Fortran Compiler 16.0 User and Reference Guide

GAP Message (Diagnostic ID 30519)

Message

Insert a "%s parallel" statement right before the loop at line %d to parallelize the loop.

Advice

Add "!DIR$ PARALLEL" before the specified loop. This directive enables the parallelization of the loop at the specified line by ignoring assumed cross-iteration data dependencies.

Example

Consider the following:

void foo(float *a, int m, int n) {
  int i;
  for (i=0; i<n; i++) {
    a[i] = a[i+m]+1;
  }
  return; 
}
subroutine foo(a, m, n)
  real a(n)
  do i=1,n
    a(i) = a(i+m) + 1
  enddo 
end

In this case, the compiler is unable to parallelize the loop without further information about m. For example, if m is negative, then each iteration will be dependent on the previous iteration. However, if m is known to be greater than n, you can parallelize the loop.

If you determine it is safe to do so, you can add the directive as follows:

subroutine foo(a, m, n)
  real a(n) 
!dir$ parallel
  do i=1,n
    a(i) = a(i+m) + 1
  enddo 
end

Verify

Confirm that any arrays in the loop do not have cross-iteration dependencies. A cross-iteration dependency exists if a memory location is modified in an iteration of the loop and accessed by a fetch or store operation in another iteration of the loop.