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

ifort bug in OMP collapse since 2019 versions

nickpapior
Beginner
1,036 Views

Dear intel,

It seems you have a serious bug in your collapse openmp statements.

I did this small code:

module fail_m
  implicit none

contains
  
  subroutine zero(n, Dk)
    integer :: n
    real :: Dk(2,n,n)

    integer :: i, j

!$OMP parallel do default(shared), collapse(2), private(i,j)
    do j = 1, n
      do i = 1, n
        Dk(1,i,j) = 0.
        Dk(2,i,j) = 0.
      end do
    end do
!$OMP end parallel do
  end subroutine zero

end module fail_m

program test
  use fail_m
  integer, parameter :: n = 200
  real :: Dk(2,n,n)

  call random_number(Dk)
  call zero(n, Dk)

  print '(f10.4)', sum(Dk)
end program test
  

and ran for multiple different versions.

In all cases the program should print out 0.0000. However, for all 2019.X versions it prints something else.

Here is a complete list of the versions I have tested (and whether they failed or succeeded).

Running intel
Success: 2013.0.028
Success: 2013.1.039
Success: 2013.1.046
Success: 2015.0.090
Success: 2015.1.133
Success: 2015.3.187
Success: 2016.1.0.423501
Success: 2016.2.0
Success: 2017.0.035
Success: 2017.1.043
Success: 2017.4.196
Success: 2017.7.065
Success: 2018.0.033
Success: 2018.1.038
Success: 2018.2.046
Success: 2018.3.051
Failed: 2019.0.117 = 29939.7344
Failed: 2019.1.144 = 29939.7344
Failed: 2019.2.187 = 29939.7344
Failed: 2019.3.199 = 29939.7344
 

I need not say how severe this is :(

/ Nick

0 Kudos
6 Replies
nickpapior
Beginner
1,036 Views

Bump this thread!

0 Kudos
Juergen_R_R
Valued Contributor I
1,036 Views

I can confirm this, ifort 17 and 18 work, 19.0 and 19.1 don't. Did you report this to the Intel Online Support Center?

0 Kudos
nickpapior
Beginner
1,036 Views

Yeah, I have just reported this: #04329792

Thanks!

0 Kudos
Cedric_A_Intel
Employee
1,036 Views

Hello and thank you for reporting this issue. I will contact the development team right away.

Regards.

 

0 Kudos
nickpapior
Beginner
1,036 Views

This also fails on 2019u5!

Failed: 2019.5.281 = 29939.7344

0 Kudos
Umar__Sait
Novice
1,036 Views

I see that on 2019.5.281 it gives the wrong result with -O2 or -O3 but gives zero for -O0 and -O1. Looks like it may be caused by a conflict with openmp collapse and unrolling.

0 Kudos
Reply