Problem when used '!$acc routine...'

      subroutine celij(j1,j2,kind_p1,ini_kind_p2,lx2)

!$acc routine seq
      use common2D

      do kind_p2=ini_kind_p2,2
        if(nc(j2,kind_p2).ne.0) then

!!$acc kernels
        do ii=1,nc(j1,kind_p1)
          i = ibox(j1,kind_p1,ii)

          do jj=1,nc(j2,kind_p2)
           j = ibox(j2,kind_p2,jj)

            drx = xp(i) - xp(j)
            drz = zp(i) - zp(j)

            call periodicityCorrection(i,j,drx,drz,lx2)

            rr2 = drx*drx + drz*drz

 ..............................................................

         enddo
        enddo
!!$acc end kernels
      endif
      enddo

      end



      subroutine ac_main

       use common2D
      interface
        subroutine celij(j1,j2,kind_p1,ini_kind_p2,lx2)
!$acc routine seq
        use common2D
        integer j1,j2,kind_p1,ini_kind_p2,lx2
        end subroutine celij
      end interface  

......................................

      call celij(j1,j1+1,kind_p1,ini_kind_p2,lx2)
........................

There are some mistake when i used the ‘routine’ statement. I don’t know why. Please help!


pgfortran.exe -O2 -acc -Minfo=accel -Mcuda=cuda8.0 -Minline,reshape -c F:\WorkSpace\MySPHysicsGpu\MySPHysicsGpu_PaperReservoirHJ\sourcefile\celij_BC_Dalrymple_2D.f -o obj\Release\sourcefile\celij_BC_Dalrymple_2D.o
PGF90-S-0155-Module variables used in acc routine need to be in !$acc declare create() - ibox (F:\WorkSpace\MySPHysicsGpu\MySPHysicsGpu_PaperReservoirHJ\sourcefile\celij_BC_Dalrymple_2D.f: 88)
PGF90-S-0155-Accelerator region ignored; see -Minfo messages (F:\WorkSpace\MySPHysicsGpu\MySPHysicsGpu_PaperReservoirHJ\sourcefile\celij_BC_Dalrymple_2D.f)
celij:
0, Accelerator region ignored
80, Accelerator restriction: invalid loop
84, Accelerator restriction: invalid loop
87, Accelerator restriction: invalid loop
0 inform, 0 warnings, 2 severes, 0 fatal for celij
Process terminated with status 2 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Hi kingbo,

PGF90-S-0155-Module variables used in acc routine need to be in !$acc declare create() - ibox

The problem here is that in order to use global variables in device routines, the global variable must be placed in a “declare” so that a device global reference is created as well.

However, you’re using these variables in a F77 Common block, which is problematic. Given that there is no one declaration of a common block, nor one layout, adding a “declare” directive for a common block variable isn’t feasible. Hence, using common blocks in OpenACC “rotuines” is not supported.

Are you able to update your code to use F90 Modules instead of F77 Common Blocks? If so, then module variables can be used in device routines.

-Mat

Hi Mat

I have already change the common block to module. Then I try to use the !$acc routine, and I get this problem.