What's the difference between device update and copyin?

When is it appropriate to use:

!$acc enter data copyin(variable)

and

!$acc update device(variable)

What is the difference?

Thanks.

Hi Michalakes,

The “enter data” directive starts an unstructured data region, which will first create a device copy of the data, and then stop (if it’s using a “create” clause), or copy the data to the device (if it’s a “copyin” clause). If the variable is already present on the device, no action will be taken other than to increment the reference counter.

The “update” directive synchronizes the host and device copies of a variable. The direction depends on the clause used, “self” copies the data from the device to the host, and “device” copies from the host to the device. The variable must be present (already created on the device) so must be within the scope of a data region (structured or unstructured).

Hope this helps,
Mat