function/procedure calls are not supported ?

Hello,
I am using pgi 14.6. It seems that the “$acc routine” directive is not supported. Can someone please verify this?

Shown below is a toy program. I create an array of length 10 and call an adder subroutine to add a value to every element of it.

Compiling it with “pgfortran -acc -Minfo routine.f90” gives

PGF90-S-0155-Accelerator region ignored; see -Minfo messages (routine.f90: 37)
routine_test:
37, Accelerator region ignored
39, Accelerator restriction: function/procedure calls are not supported
40, Accelerator restriction: unsupported call to ‘add’
0 inform, 0 warnings, 1 severes, 0 fatal for routine_test


module m_adder
  implicit none

  interface
  !$acc routine
    subroutine adder(i,isum)
      integer, intent(in) :: i
      integer, intent(inout), dimension(:) :: isum
    end subroutine
  end interface
  contains

  subroutine add(i,isum)
    implicit none

    integer, intent(in)     :: i
    integer, intent(inout),dimension(:)  :: isum

    isum(i) = isum(i) + i

  end subroutine add
end module m_adder

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
program routine_test
  use m_adder
  implicit none

  integer,dimension(10) :: isum
  integer               :: i

  do i=1,10
    isum(i) = 0
  end do

!$acc kernels copy(isum)
!$acc loop independent
  do i=1,10
    call add(i,isum)
    !isum(i) = isum(i) + i
  end do
!$acc end kernels

  print *, isum

end program routine_test

Hi,

Looks like you added the “routine” directive to the interface for the “adder” routine, not the “add” routine which is what is called. Also, the default for “routine” is the “gang” schedule, so you should add the “seq” clause.

Note if “add” did have an explicit interface, then “routine” needs to be added to both the definition and the interface.

Hope this helps,
Mat

% cat add.f90

module m_adder
   implicit none

   interface
     subroutine adder(i,isum)
   !$acc routine seq
       integer, intent(in) :: i
       integer, intent(inout), dimension(:) :: isum
     end subroutine
   end interface
   contains

   subroutine add(i,isum)
     implicit none
   !$acc routine seq
     integer, intent(in)    :: i
     integer, dimension(:)  :: isum
     isum(i) = isum(i) + i
   end subroutine add
 end module m_adder

 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 program routine_test
   use m_adder
   implicit none

   integer,dimension(10) :: isum
   integer               :: i, val

   do i=1,10
     isum(i) = 0
   end do

 !$acc kernels copy(isum)
 !$acc loop independent
   do i=1,10
     call add(i,isum)
    ! isum(i) = isum(i) + i
   end do
 !$acc end kernels

  print *, isum

 end program routine_test

% pgf90 -acc -Minfo=accel -o add.out add.f90 ; add.out
add:
     14, Generating acc routine seq
         Generating Tesla code
routine_test:
     36, Generating copy(isum(:))
         Generating Tesla code
     38, Loop is parallelizable
         Accelerator kernel generated
         38, !$acc loop gang, vector(32) ! blockidx%x threadidx%x
            1            2            3            4            5            6
            7            8            9           10

Thank you.