Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29238 Discussions

OpenMP bug when combining IF and DEPEND clauses in a TASK construct

Theo_M_
Beginner
588 Views

Hello,

I believe the following code produces an incorrect result:

program main
!$ use omp_lib
  integer a,i
  !$omp parallel
  !$omp master
  do i=1,10
  !$omp task firstprivate(i) if(i>5) depend(inout:a)
    write(*,*) '--->',i
  !$omp end task
  enddo
  !$omp end master
  !$omp end parallel 
end program

What happens is the undeferred tasks (those for which the IF clause evaluates to false) are not executed at all, i.e., the code prints:

 --->           6
 --->           7
 --->           8
 --->           9
 --->          10

The problem disappears if either the IF or DEPEND clause are removed.

I have observed this problem with ifort 15.0.2 and 16.0.1. gfortran 4.9.3 produces the correct result.

Can the developers confirm this is a bug?

Thanks,

Theo

0 Kudos
3 Replies
Martyn_C_Intel
Employee
588 Views

Hello Theo,

                   We agree this appears to be a bug. It has been escalated to the compiler developers to fix; we'll let you know when a compiler containing a fix becomes available. Thanks for the report and clear test case!

Martyn Corden

Intel Developer Support

0 Kudos
Martyn_C_Intel
Employee
588 Views

Hello Theo,

                   A fix has been found for this issue and it should be available in the next update to the version 16 compiler.

The issue is also fixed in the latest version 17.0 beta compiler, if you have access to that. The fix will also be in the version 17.0 release.

Martyn Corden

Intel Developer Support

0 Kudos
Martyn_C_Intel
Employee
588 Views

The 16.0 update 4 compiler (16.0.4.210)  from Intel Parallel Studio XE 2016 containing this fix is now available from the Intel registration center, as is the 17.0 compiler release from Intel Parallel Studio XE 2017. Please let us know if these don't work as you expect.

0 Kudos
Reply