| View previous topic :: View next topic |
| Author |
Message |
RTLEE
Joined: 01 Mar 2006 Posts: 19
|
Posted: Mon Oct 05, 2009 8:47 am Post subject: CUDA Fortran : device variable in module |
|
|
In section 3.2.1 of the CUDA Fortran Programming Guide, it says that device variables and arrays may appear in host and device modules. However, the following simple code always gives the error "copyin Symbol Memcpy FAILED: 13". I'd appreciate any ideas anyone has.
Thanks!
| Code: | module cudamod
implicit none
integer, device :: int_d(1)
end module cudamod
program fcuda
use cudafor
use cudamod
implicit none
integer :: int_h(1)
int_h = 0
int_d = int_h
end program fcuda
|
|
|
| Back to top |
|
 |
brentl
Joined: 20 Jul 2004 Posts: 107
|
Posted: Mon Oct 05, 2009 4:06 pm Post subject: |
|
|
Hi,
This is a known problem. Currently, the registering of the structure containing module device data is triggered by the presence of device code in the module. We will address this in a near-term future release.
For now, the work-around is to add a global routine. It doesn't have to do anything.
contains
attributes(global) subroutine foo
end subroutine
end module cudamod |
|
| Back to top |
|
 |
RTLEE
Joined: 01 Mar 2006 Posts: 19
|
Posted: Tue Oct 06, 2009 5:53 am Post subject: |
|
|
Thanks for the reply. I just tried that, but I still get the same error. I've pasted the complete code below.
Thanks! - Todd
| Code: | module cudamod
implicit none
integer, device :: int_d(1)
contains
attributes(global) subroutine foo
end subroutine foo
end module cudamod
program fcuda
use cudafor
use cudamod
implicit none
integer :: int_h(1)
int_h = 0
int_d = int_h
end program fcuda |
|
|
| Back to top |
|
 |
brentl
Joined: 20 Jul 2004 Posts: 107
|
Posted: Thu Oct 08, 2009 11:08 am Post subject: |
|
|
Sorry, I was running the wrong version of the compiler.
Setting device data in a module won't be supported in the beta compilers. It will work in our November release. |
|
| Back to top |
|
 |
|