PGF90-S-0155-Procedures called in a compute region must have acc routine information

SUBROUTINE SlopeX(iy,iz)
      use var_inc
      implicit none
      integer  iy,iz,ix,k
      real sL,sR
      real sgn

!Limiter on
      if(I_Limiter) then
            !   df/dx

           do ix=0,lx+1
            !$acc parallel loop
            do k=0,npop-1
            sL=(gp(k,ix,iy,iz)-gp(k,ix-1,iy,iz))/(xc(ix)-xc(ix-1)) 
            sR=(gp(k,ix+1,iy,iz)-gp(k,ix,iy,iz))/(xc(ix+1)-xc(ix))
            sgx(k,ix)=(sgn(sR)+sgn(sL))*abs(sR)*abs(sL)/(abs(sR)+abs(sL)+1.0e-10)   
            sL=(hp(k,ix,iy,iz)-hp(k,ix-1,iy,iz))/(xc(ix)-xc(ix-1)) 
            sR=(hp(k,ix+1,iy,iz)-hp(k,ix,iy,iz))/(xc(ix+1)-xc(ix))
            shx(k,ix)=(sgn(sR)+sgn(sL))*abs(sR)*abs(sL)/(abs(sR)+abs(sL)+1.0e-10)
            enddo
           end do
!Codes below ignored

As shown above, I encountered an error during compiling:

mpif90 -c -r8 -O4 -Minfo=accel -ta=tesla:ccall -DMPI_DEBUG evol.f90 -I/nvme1/fftw3-pgi/include -L/nvme1/fftw3-pgi/lib -lfftw3 -lm   
PGF90-S-0155-Procedures called in a compute region must have acc routine information: sgn (evol.f90: 372)
PGF90-S-0155-Accelerator region ignored; see -Minfo messages  (evol.f90: 368)
slopex:
    368, Accelerator region ignored
    372, Accelerator restriction: call to 'sgn' with no acc routine information
  0 inform,   0 warnings,   2 severes, 0 fatal for slopex
make: *** [evol.o] Error 2

PS: An function named also SGN is defined in another file “initial1.f90”(not included)

!-----------------------------------------------------------------
! The sign function
      REAL FUNCTION SGN(X)
      !$acc routine
      real x
      if(x.eq.0.0)then
      SGN = 0.0
      else if(x.lt.0.0)then
      SGN = -1.0
      else
      SGN = 1.0
      end if
      RETURN
      END FUNCTION SGN

Hi Vincent,

For routines without an interface, you must also add “!$acc routine(sgn)” within “SlopeX” so the compiler knows the call has a device routine. Something like:

SUBROUTINE SlopeX(iy,iz)
      use var_inc
      implicit none
      integer  iy,iz,ix,k
      real sL,sR
      real sgn
!$acc routine(sgn) seq

Hope this helps,
Mat