omp target update

Makes the items listed in the device data environment consistent between the device and host, in accordance with the motion clauses on the pragma.

Syntax

#pragma omp target update [clause[, clause, ...]]

Arguments

clause

Can be any of the following caluses:

  • device(integer-expression)

  • if( scalar-expression )

  • from( list )

  • to( list )

Description

This pragma causes data to be copied between the host and device, based on the motion clauses on the pragma. The from clause causes data to be copied from the device to the host. The to clause causes data to be copied from the host to the device. If an if expression evaluates to false, then no copies occur.

Example: Copying values from the host to the device and from the device to the host

#pragma omp target update to(a,b) from(c,d)

The above example demonstrates how to use this pragma to copy the value of a and b on the host to the device then copy the values of c and d on the device to the host.

For more complete information about compiler optimizations, see our Optimization Notice.