Visible to Intel only — GUID: GUID-0D875C99-8B7F-4802-B31B-D0C47260732E
Visible to Intel only — GUID: GUID-0D875C99-8B7F-4802-B31B-D0C47260732E
OpenMP Directives
Intel® compilers, icx, icpx, and ifx support various OpenMP directives that control the offloading of computations and mapping of data onto a device. These include:
target
teams
distribute
target data
target enter data
target exit data
target update
declare target
dispatch
interop
The target construct specifies that a specific part of the code is to be executed on the device and how data is to be mapped to the device.
The teams construct creates a number of thread teams, where each team is composed of a master thread and a number of worker threads. If teams is specified without the num_teams clause, then the number of teams is implementation defined.
The distribute construct distributes iterations of a loop among the master threads of the teams, so each master thread executes a subset of the iterations.
The target data construct maps variables to a device data environment. Variables are mapped for the extent of the target data region, according to any map clauses.
The target enter data directive specifies that variables are mapped to a device. With this directive, the map-type specified in map clauses must be either to or alloc.
The target exit data directive specifies that variables are unmapped from the device. With this directive, the map-type specified in map clauses must be from, release, or delete.
The target update directive makes the values of variables on the device consistent with their original host variables, according to the specified motion clauses.
The declare target directive specifies that variables, functions (C, C++ and Fortran), and subroutines (Fortran) are mapped to a device.
The declare variant directive declares a specialized variant of a base function and specifies the context in which that specialized variant is used.
The dispatch construct controls whether variant substitution occurs for a given function call.
The interop construct retrieves interoperability properties from the OpenMP implementation to enable interoperability with foreign execution contexts.
The map clause determines how an original host variable is mapped to a corresponding variable on the device. Map-types include:
to: The value of the original host variable is copied to the device on entry to the target region.
from: The value of the variable on the device is copied from the device to the original host variable on exit from the target region.
tofrom: The value of the original host variable is copied to the device on entry to the target region, and copied back to the host on exit from the target region.
alloc: Allocate an uninitialized copy of the original host variable on the device (values are not copied from the host to the device).
Directives can be combined. For example, the following combined directives may be used:
target teams
target teams distribute
target teams distribute parallel for
target teams distribute parallel for simd
It is recommended that combined directives be used where possible because they allow the compiler and runtime to decide how to best partition the iterations of an offloaded loop for execution on the GPU.