Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

TARGET DATA

OpenMP* Fortran Compiler Directive: Maps variables to a device data environment for the extent of the region. This feature is only available for ifx.

Syntax

!$OMP TARGET DATA [clause[[,] clause]... ]

   loosely-structured-block

!$OMP END TARGET DATA

-or-

!$OMP TARGET DATA [clause[[,] clause]... ]

   strictly-structured-block

[!$OMP END TARGET DATA]

clause

Is one or more of the following:

At most one DEVICE clause and one IF clause can appear for the construct.

At least one USE_DEVICE_PTR, USE_DEVICE_ADDR, or MAP clause must appear for the construct.

The map-type in a MAP clause must be TO, FROM, TOFROM, or ALLOC.

loosely-structured-block

Is a structured block (section) of statements or constructs. You cannot branch into or out of the block.

strictly-structured-block

Is a Fortran BLOCK construct. You cannot branch into or out of the BLOCK construct.

The binding task region for a TARGET DATA construct is the encountering task. The target region binds to the enclosing parallel or task region.

When a TARGET DATA construct is encountered, a new device data environment is created, and the encountering task executes the target data region.

Occurrences of a list item appearing in a USE_DEVICE_ADDR clause in the structured block of the construct are references to the device address of the item if the item has corresponding storage in the device data environment. If the list item is not mapped, it is assumed to be accessible on the target device. The host storage of a list item that has a device address may not be accessible from within the structured block. List items can include array sections.

If a list item in a USE_DEVICE_PTR clause is not of type C_PTR from the intrinsic module ISO_C_BINDING, it is treated as if it appeared in a USE_DEVICE_ADDR clause. The use of non-C_PTR types in a USE_DEVICE_PTR clause has been deprecated.

A program must not depend on any ordering of the evaluations of the clauses of the TARGET DATA directive, or on any side effects of the evaluations of the clauses, except that list items in any MAP clause are data mapped prior to the conversion of any list items in a USE_DEVICE_PTR or USE_DEVICE_ADDR clause to their device storage locations within the structured block.

List items in USE_DEVICE_PTR and USE_DEVICE_ADDR clauses can not be specified more than once in the same or any other USE_DEVICE_PTR or USE_DEVICE_ADDR clause for the construct.

A list item in a USE_DEVICE_PTR or a USE_DEVICE_ADDR clause must not be a component of a derived type.

List items in a USE_DEVICE_ADDR clause must have been mapped to the device, or be accessible on the device from the host data environment. Similarly, the value of a list item in a USE_DEVICE_PTR that is of type C_PTR must be the address of an entity that has storage in the device data environment or that is accessible on the device from the host data environment.

If a list item in a USE_DEVICE_ADDR is an array section, the designator of the base expression cannot contain any construct association selectors.

The same variable can be used in both the MAP clause and the USE_DEVICE_PTR clause or a USE_DEVICE_ADDR clause:

!$OMP TARGET DATA MAP(X, Y) USE_DEVICE_PTR(X) USE_DEVICE_ADDR (Y)
    block
!$OMP END TARGET DATA