| View previous topic :: View next topic |
| Author |
Message |
appleluo
Joined: 21 Nov 2012 Posts: 19
|
Posted: Thu Jan 03, 2013 2:54 pm Post subject: Strange data clause behaviors with OpenACC |
|
|
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 |
|
 |
PaulPa
Joined: 02 Aug 2012 Posts: 35
|
Posted: Mon Jan 07, 2013 7:33 am Post subject: |
|
|
HI appleluo,
try "!$acc update host(var1)" at the end of sub1
Best,
Paul |
|
| Back to top |
|
 |
appleluo
Joined: 21 Nov 2012 Posts: 19
|
Posted: Thu Jan 17, 2013 8:59 am Post subject: |
|
|
| Thanks. |
|
| Back to top |
|
 |
|