PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

calling random_number() in global subroutine

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



Joined: 21 Jan 2010
Posts: 33

PostPosted: Fri Apr 06, 2012 10:51 am    Post subject: calling random_number() in global subroutine Reply with quote

The PGI CUDA Fortran guide has a section "Fortran Intrinsics" which says, "This section lists the Fortran intrinsic functions allowed in device subprograms." Below that, in Table 3.7, is listed "random_number" and "random_seed."

However, in my code, I have a few lines in an attributes(global) subroutine:

Code:
real :: drps(128)
call random_number(drps)


and when I try to compile this, I get an error message: "Calls from device code to a host subroutine are allowed only in emulations mode - random_number" If I comment the call out, it compiles just fine.

Guess I'm confused. Can I call random_number somehow? If not, what did the manual mean? Thanks.
Back to top
View user's profile
mkcolg



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

PostPosted: Fri Apr 06, 2012 2:43 pm    Post subject: Reply with quote

Hi cablesb,

There are still a few features left to implement in CUDA Fortran, and random number generation is one of the them. It turned out to be a very difficult to implement and most likely wont be available for some time if at all.

In the mean time, a list of random numbers need to be pre-computed, either on the host or device. An example of this can be found in my article Tuning a Monte Carlo Algorithm on GPUs. Besides the Mercenne Twister code I use, you could also use CURAND.

- 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