PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

CUDA Fortran : device variable in module

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



Joined: 01 Mar 2006
Posts: 19

PostPosted: Mon Oct 05, 2009 8:47 am    Post subject: CUDA Fortran : device variable in module Reply with quote

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
View user's profile
brentl



Joined: 20 Jul 2004
Posts: 132

PostPosted: Mon Oct 05, 2009 4:06 pm    Post subject: Reply with quote

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
View user's profile
RTLEE



Joined: 01 Mar 2006
Posts: 19

PostPosted: Tue Oct 06, 2009 5:53 am    Post subject: Reply with quote

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
View user's profile
brentl



Joined: 20 Jul 2004
Posts: 132

PostPosted: Thu Oct 08, 2009 11:08 am    Post subject: Reply with quote

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