PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Question about loop including function/procedure call

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



Joined: 19 Apr 2012
Posts: 7

PostPosted: Mon Apr 23, 2012 6:52 am    Post subject: Question about loop including function/procedure call Reply with quote

Hello,

I am using PGI programming for some days only and I am still learning a lot from each page I am reading about it. Yet, I am stuck on a question which I do not find the answer:

I would like to improve the computing efficiency of a fortran application I am developing through parallelization of the code on GPU. However, the loop I intend to parallelize include a function call which is itself calling a function. From what I have read until now, such a loop appears not to be parallelizable and that's exactly the compiler warning message I received: "Accelerator region ignored -> function/procedure calls are not supported" (Here is the compiler comand I used: pgfortran -plmex.f90 -zbsubs.f -machine.f90 -ta=nvidia -Minfo=accel -Minline -Mipa=inline, so I consider inlining) ... unfortunately but not really surprisingly...

... until I have read this post https://www.pgroup.com/userforum/viewtopic.php?t=2222 in which the code presents a loop with function and then a subroutine calls, but for which parallelization seems to work. I also succeded to compile it on my machine.
Why is it working here, is it a particular case?
And more generally, is there a way to circumvent problems of loop parallelization when it contains function or procedure call?

Sorry for this, may be, basic question and many thanks in advance for helping me!
Fred
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Apr 23, 2012 7:40 am    Post subject: Reply with quote

Hi Fred,

Functions called within an accelerator region must first be inlined before the region can be accelerated. Currently, the GPU does not support true subroutine calling, hence the restriction. In the case of the other post, the FUNC routine was inlined. In your case, look at the "-Minfo=inline" messages to determine why the compiler is not able to automatically inline your routines.

For help on Inlining into accelerator regions, you may find this post helpful: https://www.pgroup.com/userforum/viewtopic.php?t=2984

Hope this helps,
Mat
Back to top
View user's profile
andref



Joined: 19 Apr 2012
Posts: 7

PostPosted: Tue Apr 24, 2012 6:18 am    Post subject: Reply with quote

Hi Mat,

Thank you so much for this very quick reply. It helped me a lot and I could already solve several inlining problems, mainly related to FOTMAT and DATA statements.
Yet, I apparently still have some inlining problems but I cannot identify them because there are so many "-Minfo=inline" messages that, at the end of the compilation, I cannot access anymore to the first ones in the compiler command window. I am trying to capute them with print screens during compilation but it is not so easy.
Is there a way to export these messages in a text file? or something else...?

Thanks again,
Fred
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Apr 24, 2012 12:44 pm    Post subject: Reply with quote

Hi Fred,

If you're running from a command line shell, you should be able to redirect stderr to a file. "pgfortran -c ... >& logfile.txt". Which shell are you using?

- 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