Generic interface resolution fails with host_data directive

Hi all,

NVFORTRAN-S-0155-Could not resolve generic procedure toto (zut.F90: 11)
0 inform, 0 warnings, 1 severes, 0 fatal for main

run.sh (183 Bytes)
zut.F90 (245 Bytes)

Are generic interfaces allowed with host_data directives ?

Regards,

Philippe

The problem here is that you’re trying to pass a device array to a subroutine that’s expecting a host array, hence the compiler can’t find a procedure that matches. You want to either change TOTOX to use the CUDA Fortran “device” attribute, or add a new subroutine to handle the device array. For example:

PROGRAM MAIN

INTERFACE TOTO
  PROCEDURE TOTOX
#ifdef _OPENACC
  PROCEDURE TOTOX_DEV
#endif
END INTERFACE

INTEGER, PARAMETER :: N = 10
REAL :: X (N)

!$ACC host_data use_device (X)
CALL TOTO (X, N)
!$ACC end host_data

CONTAINS

SUBROUTINE TOTOX (X, N)
REAL :: X (N)
INTEGER,value :: N
END SUBROUTINE

#ifdef _OPENACC
SUBROUTINE TOTOX_DEV (X, N)
use cudafor
REAL,device :: X (N)
INTEGER,value :: N
END SUBROUTINE
#endif

END

Be sure to add the “-cuda” option to enable CUDA Fortran.

% nvfortran -c zut.F90 -acc -cuda

Hope this helps,
Mat

Good, thank you, I can do that.