# mirror + data copyin

**URL:** <https://forums.developer.nvidia.com/t/mirror-data-copyin/133823>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [November 5, 2013, 10:27am UTC](https://forums.developer.nvidia.com/t/mirror-data-copyin/133823 "2013-11-05T10:27:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AROM](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@AROM](https://forums.developer.nvidia.com/u/AROM)\
**Post date:** [November 5, 2013, 10:27am UTC](https://forums.developer.nvidia.com/t/mirror-data-copyin/133823/1 "2013-11-05T10:27:03Z")

</div>

Hi!

working with a huge project I faced with the following stuff: I marked one array to be mirrored on GPU (!$acc mirror) and after that I used "acc data present " and “acc update host/device” in my code. Launching the application I got wrong result. Reason - co-developer used the same array in “acc data copyin” section (right before the data section array was modified on the host). PGI didn’t create a copy of the array. It checked that array have been mirrored on GPU and mapped host and device arrays without moving data on device (copyin).

Could you explain the difference of p\_copyin and copyin in this case? Why doesn’t PGI inform that I use data section inside another data section for the same variable?

PGI 13.10/linux

Alexey

---

<div class="post-metadata">

**Author:** ![MatColgrove](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/matcolgrove/32/14047_2.png) [@MatColgrove](https://forums.developer.nvidia.com/u/MatColgrove)\
**Post date:** [November 6, 2013, 7:33pm UTC](https://forums.developer.nvidia.com/t/mirror-data-copyin/133823/2 "2013-11-06T19:33:17Z")

</div>

Hi Alexey,

Since OpenACC only allows one copy of a variable on the device, the run time should be aborting with an error instead of using the device copy. I’ve added TPR#19657 and sent it on to engineering.

Thanks for pointing this out.

- Mat

---

<div class="post-metadata">

**Author:** ![AROM](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@AROM](https://forums.developer.nvidia.com/u/AROM)\
**Post date:** [November 25, 2013, 11:20am UTC](https://forums.developer.nvidia.com/t/mirror-data-copyin/133823/3 "2013-11-25T11:20:50Z")

</div>

Here is my Perl script which helps me to find some errors in my code. [URL](http://www.ccfit.nsu.ru/arom/data/parse.pl)

It parses log file obtained with PGI\_ACC\_DEBUG environment variable.

```nohighlight
PGI_ACC_DEBUG=1 ./wrf.exe 2>log.debug
./parse.pl < log.debug

```

it gave me some warnings like

```nohighlight
[16795] >> Check for 'mudf' to device (0x10718120 -> 0x0). Origin name: mudf_pt
!! WARNING: copyin for mirror variable. lineno=763
!! WARNING: create for mirror variable. lineno=763
[16797] >> mapping found: 0x10718120 -> 0x6465a00 for mudf_pt
[16807] >>>>>>> Kernel advance_uv_766_gpu
[16813] >>>>>>> Kernel advance_uv_770_gpu
[16820] >> Check for 'mudf' to host (0x10718120 -> 0x6465a00). Origin name: mudf_pt
!! WARNING: copyin for mirror variable. lineno=774
!! WARNING: create for mirror variable. lineno=774
[16821] >> mapping found: 0x10718120 -> 0x6465a00 for mudf_pt

```
