Attibutes(host,device) - is it supported in 10.5 ?

I am working on parallelizing my CFD code using CUDA Fortran, and I want some subroutines to be called by host and device subroutines. However I got compilation error when I am trying to call (device,host) subroutine from any host subroutine or program, as in the example:

module mod_fun
use cudafor
  attributes(host,device) subroutine Plus2(x,y)
    implicit none
    integer,intent(in)  :: x
    integer,intent(out) :: y
  end subroutine Plus2
end module mod_fun

program test
use mod_fun
implicit none
integer :: i,j
call Plus2(i,j)
end program test

When I am trying to compile this simple code I get the following:

$ pgfortran -Mcuda=cc13 -c test_host_device.f90
PGF90-S-0188-Argument number 1 to plus2: type mismatch (test_host_device.f90: 17)
PGF90-S-0188-Argument number 2 to plus2: type mismatch (test_host_device.f90: 17)
  0 inform,   0 warnings,   2 severes, 0 fatal for test

Does anyone know if attibutes(host,device) is supported in pgfortran 10.5 ??

Hi Folo,

No, sorry. You’ll need to create two version of the routine, one for the host and one for the device.

  • Mat