Problem with fortran 77 acc routine

Hi, I am trying to compile this simple test in fortran 77:

      subroutine mult( a, b,c,i)
!$ACC ROUTINE
          real*4 :: b(*), a(*), c(*)
          integer :: i
          c(i) = a(i)*b(i)
      end

      subroutine testit
      real*4 :: a0(100), b0(100), c0(100)
      integer :: i,n
      
      n=10
      
!$ACC PARALLEL LOOP
      do i = 1, N
       a0(i) = real(i)
       b0(i) = real(i) + 1
      enddo
!$ACC END PARALLEL

!$ACC PARALLEL LOOP
      do i = 1, N
       call mult( a0, b0, c0,i )
      enddo
!$ACC END PARALLEL

      do i = 1, N
       print *, a0(i), b0(i) ,c0(i)
      enddo

      end


      program main()
          use openacc
          call testit()
      end

But the compiler gives me a error:
pgfortran -acc -Minfo=all t4.f
mult:
1, Generating acc routine seq
Generating Tesla code
PGF90-S-0155-Procedures called in a compute region must have acc routine information: mult (t4.f: 23)
PGF90-S-0155-Accelerator region ignored; see -Minfo messages (t4.f: 21)
testit:
14, Accelerator kernel generated
Generating Tesla code
15, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
14, Generating copyout(b0(:10),a0(:10))
21, Accelerator region ignored
23, Accelerator restriction: call to ‘mult’ with no acc routine information
0 inform, 0 warnings, 2 severes, 0 fatal for testit

I am using: pgfortran 15.7-0 64-bit target on x86-64 Linux -tp haswell

Hi esepulveda26247,

You just need to add “!$acc routine(mult) seq” to “testit” so the compiler knows that there’s a device routine available for “mult”.

% cat test.f
      subroutine mult( a, b,c,i)
!$ACC ROUTINE seq
          real*4 :: b(*), a(*), c(*)
          integer :: i
          c(i) = a(i)*b(i)
      end

      subroutine testit
      real*4 :: a0(100), b0(100), c0(100)
      integer :: i,n
!$acc routine(mult) seq

      n=10

!$ACC PARALLEL LOOP
      do i = 1, N
       a0(i) = real(i)
       b0(i) = real(i) + 1
      enddo
!$ACC END PARALLEL

!$ACC PARALLEL LOOP
      do i = 1, N
       call mult( a0, b0, c0,i )
      enddo
!$ACC END PARALLEL

      do i = 1, N
       print *, a0(i), b0(i) ,c0(i)
      enddo

      end


      program main()
          use openacc
          call testit()
      end
% pgfortran -V15.7 -acc -Minfo=accel test.f; ./a.out
mult:
      2, Generating acc routine seq
testit:
     16, Accelerator kernel generated
         Generating Tesla code
         17, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
     16, Generating copyout(b0(:10),a0(:10))
     23, Accelerator kernel generated
         Generating Tesla code
         24, !$acc loop gang, vector(128) ! blockidx%x threadidx%x
     23, Generating copy(c0(:),b0(:),a0(:))
    1.000000        2.000000        2.000000
    2.000000        3.000000        6.000000
    3.000000        4.000000        12.00000
    4.000000        5.000000        20.00000
    5.000000        6.000000        30.00000
    6.000000        7.000000        42.00000
    7.000000        8.000000        56.00000
    8.000000        9.000000        72.00000
    9.000000        10.00000        90.00000
    10.00000        11.00000        110.0000

Hope this helps,
Mat

Thank you. This does not happen when you are using >= fortran 90.

This does not happen when you are using >= fortran 90.

Correction. It does not happen in F90 only if you are using an implicitly defined interface in a module since the compiler has access to the routine’s definition. You still need this when there isn’t an interface but also in interface block.

  • Mat