update vs copy

Hello,

Is there any reason to use one over the other (besides aesthetic purposes)? For example, is there a difference between

!$acc update host(list)
and
!$acc pcopyout(list)

Same idea for update device and pcopyin.



Also, a second unrelated question. Suppose I have the structure below:
!$acc data region copy(a,b,c)
!$acc kernels
loop that uses a, b, and c
!$acc end kernels
!$acc end data region

The compiler feedback tells me that a, b, and c are copied in the data region, and tells me again that a, b, and c are copied for the kernels region. This is just redundant, and a, b, and c are not actually being copied twice, correct? And is this still correct even in older compilers that don’t by default use the present_or copy versions?

Thanks,
Ben

Hi Ben,

The update directive is used to synchronize data within a data region while the copy clauses only synchronize data at the beginning or end of a data region.

The compiler feedback tells me that a, b, and c are copied in the data region, and tells me again that a, b, and c are copied for the kernels region. This is just redundant, and a, b, and c are not actually being copied twice, correct?

These messages are confusing but the data isn’t being copied twice. The compiler is adding a device look-up just before the kernel launches since the look-up is associated with an address rather than a variable name. This allow for such things as pointer swapping in a data region and data regions to span across routine calls.

Hope this helps,
Mat