インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス
OpenMP* Fortran Compiler Directive: Creates a device data environment and executes the construct on that device. This directive only applies when targeting Intel® Xeon Phi™ products.
!$OMP TARGET [clause[[,] clause]... ]
block
!$OMP END TARGET
clause |
Is one or more of the following:
|
block |
Is a structured block (section) of statements or constructs. No branching into or out of the block of code is allowed. |
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 clause USE_DEVICE_PTR.
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.
If a variable appears in a REDUCTION or LASTPRIVATE clause on a combined construct for which the first construct is TARGET, 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.