Intel® C++ Compiler 16.0 User and Reference Guide
Makes the items listed in the device data environment consistent between the device and host, in accordance with the motion clauses on the pragma. This pragma only applies to Intel® MIC Architecture.
#pragma omp target update [clause[, clause, ...]] |
clause |
Can be any of the following clauses:
|
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. By default, program execution will wait until the offloaded task is complete. If the nowait clause is present execution may continue without waiting for the copy to complete. The depend clause creates a dependency on previous tasks. See the description in the task pragma documentation for more information.
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.
Example: Copying values from the host to the device and from the device to the host asynchronously |
---|
#pragma omp target update to(a,b) from(c,d) nowait |
In this example, the copies are performed as in the first example, but are scheduled to be executed asynchronously so that the execution may continue without waiting for the copy to complete.