PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

help understanding compiler information
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
mkcolg



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

PostPosted: Tue Oct 09, 2012 7:21 am    Post subject: Reply with quote

Hi Ben,

Quote:
How come the do private directive doesn't work in this case?
If you privatize an array, every thread gets it's own copy who's lifetime is the same as the compute region. If you privatized "den" then each thread would be accumulating it's own copy and then the contents would be destroyed at the end of the region.

What you'd really want here is to be able to use the reduction clause. However the reduction clause only works on scalars, hence you need to add the reduction code yourself.

- Mat
Back to top
View user's profile
brush



Joined: 26 Jun 2012
Posts: 44

PostPosted: Tue Oct 09, 2012 9:45 am    Post subject: Reply with quote

Thanks, I have another quick question:

My understanding is local puts x on the gpu memory and leaves it there for the duration of the data region (no copying back and forth). So then private puts 'n=# of threads' copies of x on the gpu, which are destroyed when the compute region ends.

So why doesn't it let me put a do private(x) inside a data region local(x)? Is it just because private(x) would have some problems of 'redundancy' since x was already put on the gpu once?

PGF90-S-0155-A data clause for a variable appears within another region with a data clause for the same variable dentmp.

Thanks,
Ben
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Oct 09, 2012 10:00 am    Post subject: Reply with quote

Quote:
So why doesn't it let me put a do private(x) inside a data region local(x)? Is it just because private(x) would have some problems of 'redundancy' since x was already put on the gpu once?
For "local(x)", you've created a single array in global memory shared by all threads. With "private(x)", you've created N number of x's in global memory where N is equal to the number of threads and each thread gets their own x.

Now when each thread references x, which x do they get? The shared one or the private one?

This is why x can't be use in both a local and private clause. The compiler can't tell which x you want to use.

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
Goto page Previous  1, 2
Page 2 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