PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Cuda Fortran PGF90 12.4 CUDA 4.0

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
andrew.davis



Joined: 25 Jun 2010
Posts: 1

PostPosted: Wed May 09, 2012 12:29 am    Post subject: Cuda Fortran PGF90 12.4 CUDA 4.0 Reply with quote

Hi

Just looking for advice/guidance. Does anyone know if the newest release supports non-instrinsic function calls from within device kernels now?

eg

Code:

attributes(global) subroutine test(bob,charlie)
implicit none
integer, value :: bob
integer, value :: charlie

if( bob .eq. 4 ) then
 charlie = help(bob)
endif

return

function help ( input)
implicit none
integer :: input

if(input.eq.4)then
 input=5
endif

return

end function



If it is now allowed, what things should I be aware of, e.g. should the data the function explicitly be declared to be device data?

Thanks

Andrew
Back to top
View user's profile
mkcolg



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

PostPosted: Wed May 09, 2012 8:06 am    Post subject: Reply with quote

Hi Andrew,

You've always been able to call device kernels from other device kernels provided that they have the device attribute and have the same module scope as the caller.

For example:
Code:

module foo

contains

attributes(global) subroutine test(bob,charlie)
implicit none
integer, value :: bob
integer, value :: charlie

if( bob .eq. 4 ) then
 charlie = help(bob)
endif

return
end subroutine test

attributes(device) function help (input)
implicit none
integer :: input, help

if(input.eq.4)then
 input=5
endif

return

end function help

end module foo


Note, I don't think the "value" attribute on charlie makes much sense here. Granted, this is just a toy code, but keep it in mind as you continue.

- 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