| View previous topic :: View next topic |
| Author |
Message |
SWL_EGGBABY
Joined: 16 Dec 2009 Posts: 29
|
Posted: Wed Mar 24, 2010 11:18 pm Post subject: How to use the attributes(device) subroutine sub(…) |
|
|
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 |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Mon Mar 29, 2010 3:26 pm Post subject: |
|
|
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 |
|
 |
SWL_EGGBABY
Joined: 16 Dec 2009 Posts: 29
|
Posted: Mon Mar 29, 2010 7:42 pm Post subject: How to use the attributes(device) subroutine sub(…) |
|
|
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 |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Tue Mar 30, 2010 9:08 am Post subject: |
|
|
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 |
|
 |
SWL_EGGBABY
Joined: 16 Dec 2009 Posts: 29
|
Posted: Tue Mar 30, 2010 8:04 pm Post subject: How to use the attributes(device) subroutine sub(…) |
|
|
| Thank you Mat! |
|
| Back to top |
|
 |
|