PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

How to use the attributes(device) subroutine sub()

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



Joined: 16 Dec 2009
Posts: 31

PostPosted: Wed Mar 24, 2010 11:18 pm    Post subject: How to use the attributes(device) subroutine sub() Reply with quote

module ddrealmod

type dd_real
real*8 ddr(2)
end type

interface assignment (=)
module procedure gg
end interface

contains

attributes(device) subroutine gg(qa, db)
implicit real*8 (d),type (dd_real) (q)
intent (out):: qa
intent (in):: db
qa%ddr(1) = db
qa%ddr(2) = 0.d0
return
end subroutine
end module


I can't call the subroutine,what's wrong? Is there any wrong in my code?
Please hele me thank you!
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Mar 29, 2010 3:26 pm    Post subject: Reply with quote

Hi SWL_EGGBABY,

"device" routines can only be called from "global" routines or other "device" routines. You're trying call it from host code.

- Mat
Back to top
View user's profile
SWL_EGGBABY



Joined: 16 Dec 2009
Posts: 31

PostPosted: Mon Mar 29, 2010 7:42 pm    Post subject: How to use the attributes(device) subroutine sub() Reply with quote

Hi Mat,


Thank you I understand it.
But I want to know why "device" routines can't be called from "global" routines or other "device" routines when they are in different modules.


-Swl
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Mar 30, 2010 9:08 am    Post subject: Reply with quote

Hi swl,

There's no linker for the GPU code, hence no way to associate symbols from different objects. Also, there are no calls so all device routines are inlined by the compiler, hence need to be within the same module.

Hope this helps,
Mat
Back to top
View user's profile
SWL_EGGBABY



Joined: 16 Dec 2009
Posts: 31

PostPosted: Tue Mar 30, 2010 8:04 pm    Post subject: How to use the attributes(device) subroutine sub() Reply with quote

Thank you 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