PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Strange data clause behaviors with OpenACC

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



Joined: 21 Nov 2012
Posts: 19

PostPosted: Thu Jan 03, 2013 2:54 pm    Post subject: Strange data clause behaviors with OpenACC Reply with quote

Hi,

I am new to OpenACC and need some help with the data clauses.

I have a program that copies in some variables and modifies their values on the accelerator, but need not copy them back to the host. The code segment is something like below:

program main

!$acc data copyin(var1)
call sub1
!$acc end data

end program

subroutine sub1
!$acc kernels loop present(var1)
var1 = xxxxx
!$acc end kernels
end subroutine

Now I got some strange results and want to check the intermediate value of var1. I have no debugger that supports accelerator, so I thought of copying the intermediate values to the host and print out there. I tried to replace "!$acc kernel loop present(var1)" with the following:
!$acc kernels loop copyout(var1)
!$acc kernels loop present_or_copyout(var1)
then I printed out var1 at end of sub1, I always got the initial value of var1. It seems that the changed var1 was never copied back to the host.

Any suggestions?

Thanks
Back to top
View user's profile
PaulPa



Joined: 02 Aug 2012
Posts: 35

PostPosted: Mon Jan 07, 2013 7:33 am    Post subject: Reply with quote

HI appleluo,

try "!$acc update host(var1)" at the end of sub1

Best,
Paul
Back to top
View user's profile
appleluo



Joined: 21 Nov 2012
Posts: 19

PostPosted: Thu Jan 17, 2013 8:59 am    Post subject: Reply with quote

Thanks.
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