PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Calling functions within the kernels
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
luiceur



Joined: 17 Apr 2011
Posts: 12

PostPosted: Fri Jul 22, 2011 6:43 am    Post subject: Calling functions within the kernels Reply with quote

How can we call a user defined function within a pragma accregion?? I've tried almost everything and the compiler still says :

kernel_PGI:
41, Accelerator region ignored
50, Accelerator restriction: function/procedure calls are not supported
58, Accelerator restriction: unsupported call to 'dotProduct'
PGC/x86-64 Linux 11.3-0: compilation completed with warnings

I guess it's allowed to call functions within the kernel, but how can I do it? If my functions is for instance :

float dotProduct{
return 5.0;
}
Back to top
View user's profile
mkcolg



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

PostPosted: Fri Jul 22, 2011 9:15 am    Post subject: Reply with quote

Hi luiceur,

Quote:
How can we call a user defined function within a pragma accregion?
Functions need to be inlined before they can used within an accelerator compute region. We do plan on adding support for calling CUDA C/Fortran routines from within acc regions in a later release.

For a simple function, like your dotProduct example, the compiler will be able to automatically inline them if you add the "-Minline" option when the functions are within the same file, or "-Mipa=inline" when the functions are in separate files. For functions where the compiler is unable to auto-inline, you will need to manually inline them.

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



Joined: 17 Apr 2011
Posts: 12

PostPosted: Fri Jul 22, 2011 12:08 pm    Post subject: Reply with quote

And how can I manually inline a function because I've tried -Minline=name:dotProduct and still the compiler seems to complain.
My kernel is using quite a lot external functions but I've implemented them in CUDA so it is not something that a device can not do.

BTW, thank you very much for your help
Back to top
View user's profile
mkcolg



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

PostPosted: Fri Jul 22, 2011 2:34 pm    Post subject: Reply with quote

Quote:
And how can I manually inline a function because I've tried -Minline=name:dotProduct and still the compiler seems to complain.

Do you have an example? What's the compiler's complaint?

- Mat
Back to top
View user's profile
luiceur



Joined: 17 Apr 2011
Posts: 12

PostPosted: Sat Jul 23, 2011 3:05 am    Post subject: Reply with quote

31, Accelerator region ignored
33, Accelerator restriction: function/procedure calls are not supported
34, Accelerator restriction: unsupported call to 'dotProduct'

I get a complain like that. I've tried with very simple functions and I am getting the same answer. I think I am not properly inlinining or the compiler doesn't know how to do it and I have to force it to do it.
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
Goto page 1, 2  Next
Page 1 of 2

 
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