HOME
| OPENMP API Specification: Version 5.0 November 2018

2.12.6  target update Construct

SummaryThe target update directive makes the corresponding list items in the device data environment consistent with their original list items, according to the specified motion clauses. The target update construct is a stand-alone directive.

Syntax

SVG-Viewer needed.

The syntax of the target update construct is as follows:  

 
#pragma omp target update clause[ [ [,] clause] ... ] new-line  

where clause is either motion-clause or one of the following:  

 
if([ target update :] scalar-expression) 
device(integer-expression) 
nowait 
depend([depend-modifier,] dependence-type : locator-list)  

and motion-clause is one of the following:  

 
to([mapper(mapper-identifier):]locator-list) 
from([mapper(mapper-identifier):]locator-list)  

SVG-Viewer needed.

SVG-Viewer needed.

The syntax of the target update construct is as follows:  

 
!$omp target update clause[ [ [,] clause] ... ]  

where clause is either motion-clause or one of the following:  

 
if([target update :] scalar-logical-expression) 
device(scalar-integer-expression) 
nowait 
depend([depend-modifier,] dependence-type : locator-list)  

and motion-clause is one of the following:  

 
to([mapper(mapper-identifier):]locator-list) 
from([mapper(mapper-identifier):]locator-list)  

SVG-Viewer needed.

BindingThe binding task set for a target update region is the generating task, which is the target task generated by the target update construct. The target update region binds to the corresponding target task region.

DescriptionFor each list item in a to or from clause there is a corresponding list item and an original list item. If the corresponding list item is not present in the device data environment then no assignment occurs to or from the original list item. Otherwise, each corresponding list item in the device data environment has an original list item in the current task’s data environment. If a mapper() modifier appears in a to clause, each list item is replaced with the list items that the given mapper specifies are to be mapped with a to or tofrom map-type. If a mapper() modifier appears in a from clause, each list item is replaced with the list items that the given mapper specifies are to be mapped with a from or tofrom map-type. For each list item in a from or a to clause:

SVG-Viewer needed.

The list items that appear in the to or from clauses may use shape-operators.

SVG-Viewer needed.

The list items that appear in the to or from clauses may include array sections with stride expressions.

The target update construct is a task generating construct. The generated task is a target task. The generated task region encloses the target update region.

All clauses are evaluated when the target update construct is encountered. The data environment of the target task is created according to the data-sharing attribute clauses on the target update construct, per-data environment ICVs, and any default data-sharing attribute rules that apply to the target update construct. A variable that is mapped in the target update construct has a default data-sharing attribute of shared in the data environment of the target task.

Assignment operations associated with mapping a variable (see Section 2.19.7.1 on page 939) occur when the target task executes.

If the nowait clause is present, execution of the target task may be deferred. If the nowait clause is not present, the target task is an included task.

If a depend clause is present, it is associated with the target task.

The device is specified in the device clause. If there is no device clause, the device is determined by the default-device-var ICV. When an if clause is present and the if clause expression evaluates to false then no assignments occur.

Execution Model Events Events associated with a target task are the same as for the task construct defined in Section 2.10.1 on page 384.

The target-update-begin event occurs when a thread enters a target update region.

The target-update-end event occurs when a thread exits a target update region.

Tool Callbacks Callbacks associated with events for target tasks are the same as for the task construct defined in Section 2.10.1 on page 384; (flags & ompt_task_target) always evaluates to true in the dispatched callback.

A thread dispatches a registered ompt_callback_target callback with ompt_scope_begin as its endpoint argument and ompt_target_update as its kind argument for each occurrence of a target-update-begin event in that thread in the context of the target task on the host. Similarly, a thread dispatches a registered ompt_callback_target callback with ompt_scope_end as its endpoint argument and ompt_target_update as its kind argument for each occurrence of a target-update-end event in that thread in the context of the target task on the host. These callbacks have type signature ompt_callback_target_t.

Restrictions

Cross References