HOME
| OPENMP API Specification: Version 5.1 November 2020

2.14.6  target update Construct

Summary The 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([motion-modifier[,] [motion-modifier[,] ...]: ] locator-list) 
from([motion-modifier[,] [motion-modifier[,] ...]: ] locator-list)  

where motion-modifier is one of the following:  

 
present 
mapper(mapper-identifier) 
iterator(iterators-definition)  

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([motion-modifier[,] [motion-modifier[,] ...]: ] locator-list) 
from([motion-modifier[,] [motion-modifier[,] ...]: ] locator-list)  

where motion-modifier is one of the following:  

 
present 
mapper(mapper-identifier) 
iterator(iterators-definition)  

SVG-Viewer needed.

Binding The 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.

Description A corresponding list item and an original list item exist for each list item in a to or from clause. If the corresponding list item is not present in the device data environment and the present modifier is not specified in the clause 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 the mappermotion-modifier is not present, the behavior is as if the mapper(default) modifier was specified. The effect of a motion clause on a list item is modified by a visible user-defined mapper (see Section 2.21.7.4) if the mapper has the same mapper-identifier as the mappermotion-modifier and is specified for a type that matches the type of the list item. For 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. For 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.

If a list item is an array or array section of a type for which a user-defined mapper exists, each array element is updated according to the mapper as if it appeared as a list item in the clause.

If a present modifier appears in the clause and the corresponding list item is not present in the device data environment then an error occurs and the program terminates. For a list item that is replaced with a set of list items as a result of a user-defined mapper, the present modifier only applies to those mapper list items that share storage with the original list item.

The list items that appear in a to or from may reference iterators defined by an iterators-definition appearing on an iterator modifier.

SVG-Viewer needed.

If a list item or a subobject of a list item in a motion clause has the ALLOCATABLE attribute, its update is performed only if its allocation status is allocated and only with respect to the allocated storage.

If a list item in a motion clause has the POINTER attribute and its association status is associated, the effect is as if the update is performed with respect to the pointer target.

SVG-Viewer needed.

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 motion clauses on the target update construct, per-data environment ICVs, and any default data-sharing attribute rules that apply to the target update construct. If a variable or part of a variable is a list item in a motion clause on the target update construct, the variable 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.21.7.1) 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 no device clause is present, the device is determined by the default-device-var ICV. When an if clause is present and the if clause expression evaluates to false, no assignments occur.

Execution Model Events Events associated with a target task are the same as for the task construct defined in Section 2.12.1.

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.12.1; (flags & ompt_task_target) always evaluates to true in the dispatched callback.

A thread dispatches a registered ompt_callback_target or ompt_callback_target_emi callback with ompt_scope_begin as its endpoint argument and ompt_target_update or ompt_target_update_nowait if the nowait clause is present 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 or ompt_callback_target_emi callback with ompt_scope_end as its endpoint argument and ompt_target_update or ompt_target_update_nowait if the nowait clause is present 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 or ompt_callback_target_emi_t, respectively.

Restrictions Restrictions to the target update construct are as follows:

Cross References