Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

GAP Message (Diagnostic ID 30522)

NOTE:
This feature is only available for ifort.

Message

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

Advice

Add "!DIR$ PARALLEL PRIVATE" before the specified loop. This directive enables the parallelization of the loop at the specified line.

Example

Consider the following:

subroutine foo (A, B, C, n, m1, m2)
 real (4) A(10000, 10), B(10000, 10), C(10000, 10)
 integer n, m1, m2
 real W(1000)
 integer i, j
 
 do i=1,n
   do j=1,m1
     W(j) = A(j,i) * B(j,i)
   end do
   do j=1,m2
     C(j,i) = W(j) + 1.0
   end do 
end

In this case, the compiler does not parallelize the loop since it cannot determine whether m1 >= m2.

If you know that this property is true, and that no element of W is fetched before it is written to after the loop, then you can use the recommended directive.

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

subroutine foo (A, B, C, n, m1, m2)
 real (4) A(10000, 10), B(10000, 10), C(10000, 10)
 integer n, m1, m2
 real W(1000)
 integer i, j
  
!DIR$ PARALLEL PRIVATE (W)
 do i=1,n
   do j=1,m1
     W(j) = A(j,i) * B(j,i)
   end do
   do j=1,m2
     C(j,i) = W(j) + 1.0
   end do 
end

Verify

Before an element of an array can be fetched in the loop, there must have been a previous store to it during the same loop iteration. In addition, if an element is fetched after the loop, there must have been a previous write to it before the fetch after the loop.