openacc fortran private arrays problem

Why the following simple openacc fortran code do not compile properly?

program main
   call test()

   subroutine test()
        integer, parameter:: kts=1,kte=21,its=1,ite=201,jts=1,jte=201 
        integer :: I, J, K
        REAL, DIMENSION( kts:kte ) :: DQDT

!$acc kernels
!$acc loop collapse(2) independent private(DQDT)
        DO J = jts,jte  
            DO I=its,ite
!$acc loop independent 
                DO k=kts,kte 
!$acc end kernels

   end subroutine

end program

Compiler output

[06:59 dabdi@psgcluster exp] > pgf90 --version

pgf90 17.9-0 64-bit target on x86-64 Linux -tp sandybridge 
PGI Compilers and Tools
Copyright (c) 2017, NVIDIA CORPORATION.  All rights reserved.

[07:12 dabdi@psgcluster exp] > pgf90 -acc -Minfo=accel -ta=host,tesla,cc60,cuda9.0 ss.F90
PGF90-S-0155-Accelerator region ignored; see -Minfo messages  (ss.F90: 10)
     10, Accelerator region ignored
     13, Accelerator restriction: loop contains unsupported statement type
     14, Accelerator restriction: unsupported statement type: opcode=ACCKLOOP
  0 inform,   0 warnings,   1 severes, 0 fatal for test
[07:12 dabdi@psgcluster exp] >

Hi dshawul,

The problem here is that since neither variable is used, the dead-code elimination optimization is removing them. Hence, the loops are empty and causes the error.

You can compile without optimization (i.e. -O0) or add code that uses the variables.

Hope this helps,

Thanks a lot !