PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Calling CUDA C libraries from CUDA Fortran

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



Joined: 03 May 2012
Posts: 1

PostPosted: Thu May 03, 2012 11:02 am    Post subject: Calling CUDA C libraries from CUDA Fortran Reply with quote

I'm evaluating whether I can use the CUDA Fortran and have a very basic question.

i.e. Within CUDA Fortran, would it be possible to write a kernel that calls a numerical library written in CUDA C.

I am a complete beginner to GPUs and CUDA so any advice would be appreciated.

Cheers,
Back to top
View user's profile
mkcolg



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

PostPosted: Thu May 03, 2012 11:30 am    Post subject: Reply with quote

CUDA Fortran host code is able to call a CUDA C kernel. You just need need to create an interface block using F2003 ISO_C_BINDING to ensure the kernel is called correctly. An example of this can be found in my PGinsider article: Tuning a Monte Carlo Algorithm on GPUs. See the section titled "Calling a CUDA C Random Number Generator".

This article on using GPU enabled Math Libraries my also be of interest http://www.pgroup.com/lit/articles/insider/v3n1a5.htm

At this time, there isn't a way to call CUDA C device routines from within a CUDA Fortran global kernel or device routine. Currently in CUDA, in order to call a device routine, the routine must have the same file scope (or module scope) as the caller.

Hope this helps,
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