HOME
| OPENMP API Specification: Version 5.0 November 2018

2.12.2  target data Construct

SummaryMap variables to a device data environment for the extent of the region.

Syntax

SVG-Viewer needed.

The syntax of the target data construct is as follows:  

 
#pragma omp target data clause[ [ [,] clause] ... ] new-line 
    structured-block  

where clause is one of the following:  

 
if([ target data :] scalar-expression) 
device(integer-expression) 
map([[map-type-modifier[,] [map-type-modifier[,] ...] map-type: ] locator-list) 
use_device_ptr(ptr-list) 
use_device_addr(list)  

SVG-Viewer needed.

SVG-Viewer needed.

The syntax of the target data construct is as follows:  

 
!$omp target data clause[ [ [,] clause] ... ] 
    structured-block 
!$omp end target data  

where clause is one of the following:  

 
if([ target data :] scalar-logical-expression) 
device(scalar-integer-expression) 
map([[map-type-modifier[,] [map-type-modifier[,] ...] map-type: ] locator-list) 
use_device_ptr(ptr-list) 
use_device_addr(list)  

SVG-Viewer needed.

BindingThe binding task set for a target data region is the generating task. The target data region binds to the region of the generating task.

DescriptionWhen a target data construct is encountered, the encountering task executes the region. If there is no device clause, the default device is determined by the default-device-var ICV. When an if clause is present and the if clause expression evaluates to false, the device is the host. Variables are mapped for the extent of the region, according to any data-mapping attribute clauses, from the data environment of the encountering task to the device data environment. Pointers that appear in a use_device_ptr clause are privatized and the device pointers to the corresponding list items in the device data environment are assigned into the private versions.

List items that appear in a use_device_addr clause have the address of the corresponding object in the device data environment inside the construct. For objects, any reference to the value of the object will be to the corresponding object on the device, while references to the address will result in a valid device address that points to that object. Array sections privatize the base of the array section and assign the private copy to the address of the corresponding array section in the device data environment.

If one or more of the use_device_ptr or use_device_addr clauses and one or more map clauses are present on the same construct, the address conversions of use_device_addr and use_device_ptr clauses will occur as if performed after all variables are mapped according to those map clauses.

Execution Model Events The events associated with entering a target data region are the same events as associated with a target enter data construct, described in Section 2.12.3 on page 461.

The events associated with exiting a target data region are the same events as associated with a target exit data construct, described in Section 2.12.4 on page 469.

Tool Callbacks The tool callbacks dispatched when entering a target data region are the same as the tool callbacks dispatched when encountering a target enter data construct, described in Section 2.12.3 on page 461.

The tool callbacks dispatched when exiting a target data region are the same as the tool callbacks dispatched when encountering a target exit data construct, described in Section 2.12.4 on page 469.

Restrictions

Cross References