Are kernel subroutines must called within a module ?

I don’t know if kernel subroutines must be called within a Fortran module. When I read PGI CUDA Fortran documents, I could no find about this issue.

module my_kernel
use cudafor
implicit none

attributes(global) subroutine gpu_kernel1(…)

end subroutine gpu_kernel1

attributes(device) subroutine gpu_kernel2(…)

end subroutine gpu_kernel1

end module my_kernel

Hi KOUCHI_Hiroyuki,

I don’t know if kernel subroutines must be called within a Fortran module. When I read PGI CUDA Fortran documents, I could no find about this issue.

CUDA Fortran kernels need to have a F90 interface in order to be called. Since modules implicitly add an interface, it often easiest to include them in a module, though this is not required. Alternately you can create an interface block.

-Mat

Dear Mat-san,

Understood.
Thank you for your advice.

Sincerely yours,