I’m quite confused about the Fortran compiler behavior, when using the value keyword on a kernel parameter. It seems to be possible to declare a parameter both value and intent(out) at the same time, although this clearly cannot be directly translated to CUDA C.
In my tests it does not work, data is never received back on the host, but also no compiler error is produced. Shouldn’t the combinations value,intent(out) and value,intent(inout) be forbidden by the compiler?
— Example code —
module device_code
contains
attributes(global) subroutine eval(x,y)
implicit none
integer, value, intent(in) :: x
integer, value, intent(out) :: y
y=x
end subroutine eval
end module device_code
program demo
use device_code
implicit none
integer :: x,y
x=2
y=3
call eval<<<1>>>(x,y)
print *,“x=”,x
print *,“y=”,y
end program demo