Intel® C++ Compiler 16.0 User and Reference Guide

map Clause

Clause for omp target Pragmas: Maps a variable from the data environment of the current task to the data environment of the device associated with the construct. For each original list item in this clause, a new corresponding list item is created on the device. This clause only applies to the omp target pragmas, which are only available on Intel® MIC Architecture and Intel® Graphics Technology.

map ([map-type-modifier[,]] [map-type :] list)

map-type-modifier

Specifies a modifier for certain map-types. Possible values are:

always

When the map-type is to, from, or tofrom, this modifier indicates that the corresponding list item is assigned the value of the original list item.

map-type

Determines how a list item is initialized. Possible values are:

alloc

On entry to the device region, each new corresponding list item has an undefined initial value.

delete

The reference count managing the initialization of the corresponding list item is set to zero.

from

On exit from the device region, the value of the corresponding list item is assigned to each original list item.

release

The reference count managing the initialization of the corresponding list item is decremented by one (if non-zero).

to

On entry to the device region, each new corresponding list item is initialized with the value of the original list item.

tofrom

On entry to the device region, each new corresponding list item is initialized with the value of the original list item. On exit from the device region, the value of the corresponding list item is assigned to each original list item.

If a map-type is not specified, the default is tofrom.

The map initialization and assignment are done through bitwise copy.

list

Is the name of one or more variables or array sections.

If a list item is an array section, it must specify contiguous storage.

At least one map clause must appear in a pragma that allows the clause.

threadprivate variables cannot appear in a map clause.

For pragma omp target enter data, map-type must be either to or alloc.

For pragma omp target exit data, map-type must be from, release, or delete.

If original and corresponding list items share storage, data races can result when intervening synchronization between tasks does not occur. If variables that share storage are mapped, it causes unspecified behavior.

When a corresponding list item of the original list item is in the data environment of the device associated with the construct:

When a corresponding list item is not in the data environment of the device associated with the construct:

Any variables within an omp target map region that are not specified in a map clause are treated as shared variables within the region.

Note

For Intel® Graphics Technology, physical memory is shared between the CPU and the processor graphics. The map-type values from and tofrom map to the nocopy implementation, except for direct access to global data objects. On entry to the device region the physical memory for the list items are saved in memory until exit from the device region. This reduces the offload overhead by avoiding the copy and maintains the behavior. Any CPU access to the same memory must be synchronized to avoid race conditions for both the copy and nocopy cases.