PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Some troubles with kernel generation in OpenACC
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
paokara



Joined: 06 Feb 2011
Posts: 24

PostPosted: Tue Jan 29, 2013 4:50 am    Post subject: Reply with quote

Hi Mat

Quote:

If I understand this correctly, you have a function (function1) which contains an OpenACC data region and a compute region.


That's correct.

Quote:
Near the 2d nest loop, you have a function call (to function2) where you want to use the same data from the local arrays (the ones in the outer data region's create clause).

The 2D nest loop is actually inside function2. And yes, i want to use the local arrays, which i "created" in the data region's create clause.

Quote:

Since data regions can span across multiple compute regions as well as host code including calls, you can have access to function1's device data from within function2 provided that function2 is called from within a data region that created the array and you use one of the "present" clauses to tell the compiler that the data is already on the device.


I did a time analysis for my program with Nvidia visual profiler and i came to some conclusions.

-First, i've noticed that using present_or_create clause, some time spent on data memory allocation of the local arrays whenever my program get's into function2. There is no data movement between host and device, but there is only memory allocation in the device which cause time penalty. Of course this time penalty is due to "create" clause and it is smaller than the penalty from the data movement between host and device. So my program "runs" faster than before, but every time i'm reaching function2, i'm having a small time penalty.
-Second, if i use ony the "present" clause, i get an error from the compiler:
Code:

FATAL ERROR: data in PRESENT clause was not found: name=myarray

so the compiler can't find the local arrays when i get inside function2. (Notice that i'm not passing this arrays as arguments of function2.) Why is that happening?
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Jan 29, 2013 12:18 pm    Post subject: Reply with quote

Quote:
so the compiler can't find the local arrays when i get inside function2. (Notice that i'm not passing this arrays as arguments of function2.) Why is that happening?
Without a real example I can't tell. This just indicates that myarray can't be found on the device and therefore not included in a data region within the same lifetime.

Note that the host and device copies of an array are not name associated. Hence, if you have a local array in one routine and another having the same name in a second routine, they are not the same array. The array used in a present clause must lie within the same host address range as the array in the data region clause. Actually, the names can be completely different or one can be a subset of the other.

- 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