How can a Fortran-OpenACC routine call another Fortran-OpenACC routine?
<p>I'm currently attempting to accelerate a spectral element fluids solver by porting most of the routines to a GPGPU using OpenACC with the PGI (15.10) compiler. The source code is written in OO-Fortran. This software has &quot;layers&quot; of subroutines that call other functions and subroutines. To bring the code over to a GPU using openacc, I've been first attempting to place &quot;$acc routine&quot; directives in each routine that needs to be ported. During compilation, using &quot;pgf90 -acc -Minfo=accel&quot;, I receive the following error :</p>
<blockquote>
<p>nvvmCompileProgram error: 9.</p>
<p>Error: /tmp/pgacc2lMnIf9lMqx8.gpu (146, 24): parse invalid forward reference to function 'innerroutine_' with wrong type!</p>
<p>PGF90-S-0155-Compiler failed to translate accelerator region (see -Minfo messages): Device compiler exited with error status code (Test.f90: 1)</p>
</blockquote>
<p>This same problem can be reproduced with the following simple fortran program :</p>
<pre><code>PROGRAM Test
IMPLICIT NONE

CONTAINS

 SUBROUTINE OuterRoutine( sol, xF, N )
 !$acc routine
   IMPLICIT NONE
   INTEGER :: N
   REAL(KIND=8) :: sol(0:N,1:3)
   REAL(KIND=8) :: xF(0:N,1:3)
   ! LOCAL
   INTEGER :: i

      DO i = 0, N
         xF(i,1:3) = InnerRoutine( sol(i,1:3) )
      ENDDO

 END SUBROUTINE OuterRoutine
 FUNCTION InnerRoutine( sol ) RESULT( xF )
 !$acc routine
   IMPLICIT NONE
   REAL(KIND=8) :: sol(1:3)
   REAL(KIND=8) :: xF(1:3)

      xF(1) = sol(1)*sol(2)
      xF(2) = sol(1)*sol(3)
      xF(3) = sol(1)*sol(1)

 END FUNCTION InnerRoutine

END PROGRAM Test
</code></pre>
<p>Again, compiling the above program with &quot;pgf90 -acc -Minfo=accel&quot; yields the problem.</p>
<p>Does openacc support acc-enabled routines calling other acc-enabled routines ?</p>
<p>If so, what am I doing wrong ?</p>