Visible to Intel only — GUID: GUID-DC579B43-2B4C-400B-9D9B-B72774F8C1B8
Visible to Intel only — GUID: GUID-DC579B43-2B4C-400B-9D9B-B72774F8C1B8
TARGET
OpenMP* Fortran Compiler Directive: Creates a device data environment and executes the construct on that device. This feature is only available for ifx.
!$OMP TARGET [clause[[,] clause]... ]
loosely-structured-block
!$OMP END TARGET
-or-
!$OMP TARGET [clause[[,] clause]... ]
strictly-structured-block
!$OMP END TARGET
clause |
Is one or more of the following:
|
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 for a TARGET construct is the encountering task. The target region binds to the enclosing parallel or task region.
This construct provides a superset of the functionality provided by the TARGET DATA construct, except for the clauses USE_DEVICE_PTR and USE_DEVICE_ADDR.
A list item in an IS_DEVICE_PTR clause that has a type other than C_PTR is the same as if it was a list item in a HAS_DEVICE_ADDR clause. List items specified in a IS_DEVICE_PTR or HAS_DEVICE_ADDR clause cannot appear in a data sharing attribute clause in the same TARGET directive. Note that the OpenMP* Specification has deprecated non-C_PTR type list items in an IS_DEVICE_PTR clause.
The TARGET construct also specifies that the region is executed by a device. The encountering task waits for the device to complete the target region at the end of the construct.
If a TARGET, TARGET DATA, or TARGET UPDATE construct appears within an OMP TARGET region, the construct is ignored.
Execution of the target task may be deferred if the NOWAIT clause is specified; if it is not specified, the target task is an included task.
If a variable or part of a variable does not appear in an IN_REDUCTION clause and is mapped by the TARGET construct, the variable's default data-sharing attribute is shared in the data environment of the target task.
A variable that appears as a list item in an IN_REDUCTION clause is implicitly mapped as if it appears in a MAP clause with a map-type of TOFROM, and a map-type-modifier of ALWAYS.
A variable that is fully or partially mapped by the TARGET construct and that is not a list item in an IN_REDUCTION clause within the construct has a default data-sharing attribute of SHARED in the target tasks data environment.
If a variable appears in a REDUCTION or LASTPRIVATE clause in a combined TARGET construct, it is treated as if it had appeared in a MAP clause with a map-type of TOFROM for REDUCTION and a map-type of FROM for LASTPRIVATE:
! SUM is treated as MAP (TOFROM)
!$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO REDUCTION(+:SUM)
! X is treated as MAP (FROM)
!$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO LASTPRIVATE(X)
A non-scalar variable referenced in a TARGET region and not explicitly mapped is implicitly treated as MAP (TOFROM):
INTEGER A(10)
!$OMP TARGET
A(5) = 5 ! A is treated as MAP (TOFROM)
!$OMP END TARGET
If only a subsection of a non-scalar variable has been mapped in an outer target region, and that variable is then mapped implicitly inside a nested target region, that variable should not access memory outside of the mapped subsection of the variable.