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

do concurrent can not be inside of openmp-parallelized loop

foxtran
New Contributor I
281 Views

Hello!

I have tried to compile the following code

subroutine example(a, n)
  implicit none
  integer, intent(in) :: n
  real(8), intent(inout) :: a(n,n,n)
  !
  integer :: i, j, k
  integer :: tmp

  !$OMP PARALLEL DO &
  !$OMP DEFAULT(NONE) SHARED(a, n) &
  !$OMP PRIVATE(i,j,k,tmp)
  do k = 1, n
    do concurrent (i = 1:n, j = 1:n, i < j)
      tmp = a(i,j,k)
      a(i,j,k) = a(j,i,k)
      a(j,i,k) = tmp
    end do
  end do
end subroutine example

 I compiled it with ifx 2024.2.1 with the following command:

ifx do-concurrent.f90 -fopenmp

And it says, that it cannot compile that example with the following message:

do-concurrent.f90(13): error #6752: Since the OpenMP* DEFAULT(NONE) clause applies, the PRIVATE, SHARED, REDUCTION, FIRSTPRIVATE, or LASTPRIVATE attribute must be explicitly specified for every variable.   [I]
    do concurrent (i = 1:n, j = 1:n, i < j)
-------------------^
do-concurrent.f90(13): error #6752: Since the OpenMP* DEFAULT(NONE) clause applies, the PRIVATE, SHARED, REDUCTION, FIRSTPRIVATE, or LASTPRIVATE attribute must be explicitly specified for every variable.   [J]
    do concurrent (i = 1:n, j = 1:n, i < j)
----------------------------^


I and J variables are defined in !$OMP section in PRIVATE, but somewhat this code is not accepted.

With gfortran this code is compiling without any messages.

0 Kudos
1 Reply
Ron_Green
Moderator
206 Views

This is a bug.  The compiler is picking up the DEFAULT NONE  for the DO CONCURRENT but missing the other clauses.  I'll write a bug report.

Reply