PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

value and intent(out) on kernels

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Denis Altmann



Joined: 25 Nov 2004
Posts: 3

PostPosted: Wed Jul 13, 2011 8:03 am    Post subject: value and intent(out) on kernels Reply with quote

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
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6141
Location: The Portland Group Inc.

PostPosted: Thu Jul 14, 2011 12:02 pm    Post subject: Reply with quote

Hi Denis,

You are correct in that the F2003 standard explicitly forbids the use of INTENT(OUT) together with VALUE. Since INTENT is only used as a hint to the compiler, in this case, the compiler is simply ignoring the INTENT(OUT) since it's use together with VALUE doesn't make sense. However, we agree that the compiler should be issuing an error in these cases to avoid possible confusion by a user.

I have submitted a report (TPR#18010) and requested our engineers flag this situation as a semantic error.

Best Regards,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group