INTEROP
OpenMP* Fortran Compiler Directive: Identifies a foreign runtime context and identifies runtime characteristics of that context, enabling interoperability with it.
Syntax
!$OMP INTEROP clause[[[,] clause]... ]
clause |
Is one or more of the following:
|
action-clause |
Is one of the following:
You must specify at least one action-clause. Each interop-type can appear at most once in an action-clause. For the USE and DESTROY action-clauses, the interop-type is whatever interop-type was used when initializing the interop-var. |
modifier-list |
Is interop-type [[, interop-type] . . . ] |
interop-type |
Is one of the following:
TARGET and TARGETSYNC may appear at most once in the clause. At least one modifier must be specified. |
preference-spec |
Is one of the following:
|
preference-selector |
Is one of the following:
Each preference-spec may contain at most one FR preference selector. |
foreign-runtime-id |
Is a character literal constant or an integer constant with kind OMP_INTEROPP_FR_KIND. It specifies a foreign runtime environment. The character values recognized by the Intel Fortran compiler are "opencl", "sycl", and "level_zero" which have the corresponding integer values of 3, 4, and 6 respectively. You can specify named integer constants OMP_IFR_OPENCL, OMP_IFR_SYCL, and OMP_IFR_LEVEL_ZERO in the preference-spec list. Definition for these named constants are in module omp_lib. Other foreign-runtime-ids defined in the OpenMP Additional Definitions document are accepted and silently ignored. If more than one foreign-runtime-id is specified in a PREFER_TYPE modifier, the foreign-runtime-id list is scanned in left to right lexical order. The left-most supported foreign-runtime-id is used. If the implementation does not support any of the listed foreign-runtime-ids , the behavior is unspecified. |
preference-property-ext |
Is a character constant with a prefix "OMPX_" and contains no commas. It specifies a preference for an implementation defined attribute. The Intel Fortran compiler currently recognizes the "OMPX_INORDER" preference-property-ext if the foreign-runtime-id specified is OMP_IFR_SYCL or "sycl". This instructs the implementation to use an in-order queue for the underlying queue used by the interop object. |
interop-var |
Is a scalar integer variable with kind type omp_interop_kind. The interop-var of an INIT or DESTROY action-clause must not be a constant. The same interop-var cannot be specified in more than one action-clause of the INTEROP construct. |
A task that encounters an INTEROP construct executes the region.
If a DEVICE clause is not specified, the behavior is as if a DEVICE clause is present with the integer value equal to the value of the internal control variable (ICV) default-device-var specified.
OpenMP may interoperate with one or more foreign runtime environments using the INTEROP directive, the INTEROP clause on a DECLARE VARIANT directive, or the interoperability functions in the OpenMP runtime API.
A task has an interoperability requirement set, which is a logical set of properties. Properties can be added to or removed from the set by different directives. The properties can be queried by other constructs that have interoperability semantics. The following properties can be added by a construct:
DEPEND: Requires the construct enforce the synchronization relationship specified by the DEPEND clause
IS_DEVICE_PTR (list-item): Indicates that the list-item is a device pointer within the construct
NOWAIT: Indicates that the construct is asynchronous
The DISPATCH directive can add properties to the interoperability requirement set.
The DECLARE VARIANT directive can remove properties from the interoperability requirement set.
If the interop-var is initialized with TARGETSYNC, an empty mergeable task is generated. DEPEND clauses apply to the generated task. If NOWAIT is omitted, the generated task is also an included task. The INTEROP construct guarantees ordered execution of the generated task with respect to foreign tasks executing in foreign contexts through the foreign synchronization object accessible through the TARGETSYNC property of the interop-var.
If a foreign task is created prior to encountering an INTEROP construct, the foreign task must complete execution before the generated task executes. If the creation of a foreign task occurs after an INTEROP construct is encountered, the foreign task cannot begin execution until the generated task finishes execution. The INTEROP construct imposes no ordering between the thread that encounters it and foreign tasks or OpenMP tasks.