| View previous topic :: View next topic |
| Author |
Message |
happyfish
Joined: 25 Jan 2011 Posts: 7
|
Posted: Tue Dec 04, 2012 7:36 pm Post subject: CUDA Fortran:How to define variables in a kernel subroutine. |
|
|
Please see the following codes first:
module simpleOps_m
contains
attributes(global) subroutine inc(a, b)
implicit none
integer :: a(:)
integer, value :: b
integer :: i
integer :: c(256)
i = threadIdx%x
c(i)=a(i)
a(i) = a(i)+b + c(i)
end subroutine inc
end module simpleOps_m
In the line "integer :: c(256)", should I use "integer :: c(256)" or "integer, device :: c(256)“? |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Wed Dec 05, 2012 9:38 am Post subject: |
|
|
Hi Happyfish,
When a variable is declared in a device subroutine, the "device" attribute is implied. Though, you can add it if you want, so either works.
- Mat |
|
| Back to top |
|
 |
|