Problem with OpenACC & generic interface

Hi,

I try to compile this :

MODULE A

IMPLICIT NONE

INTERFACE GG
  MODULE PROCEDURE C
END INTERFACE

CONTAINS

!$acc routine (C) seq
SUBROUTINE C (K)

INTEGER :: K

END SUBROUTINE

END MODULE

!$acc routine (B) seq
SUBROUTINE B

USE A

INTEGER :: I

CALL C (I)

END SUBROUTINE B

But I get the following error :

[ufh62jk@jean-zay4: 3]$ pgf90 -acc=gpu -c truc.F90 
NVFORTRAN-S-1000-Call in OpenACC region to procedure 'c' which has no acc routine information (truc.F90: 29)
  0 inform,   0 warnings,   1 severes, 0 fatal for b

The code compile if remove the INTERFACE block.

Is this expected ?

Regards,

Philippe

Hi Philippe,

It’s an ordering issue. If you move “!$acc routine (C) seq” after the definition of the subroutine, it will work. While I’m not 100% sure on this, but I think with the module procedure, “C” isn’t in scope so the compiler can see the forward definition.

I’d recommend not using the routine directive with a name in this case, but rather put “routine” (without a name) in the subroutine itself. For example:

% cat test.f90
MODULE A

IMPLICIT NONE

INTERFACE GG
  MODULE PROCEDURE C
END INTERFACE

CONTAINS

SUBROUTINE C (K)
!$acc routine seq
INTEGER :: K

END SUBROUTINE

END MODULE

SUBROUTINE B
!$acc routine seq
USE A

INTEGER :: I

CALL C (I)

END SUBROUTINE B
% nvfortran -acc -c test.f90
%

Hope this helps,
Mat

Thank you Mats, I will do that.

Philippe