Intel® C++ Compiler 16.0 User and Reference Guide

omp target data

Creates a device data environment by making a mapping of variables from the host to the target device. This pragma only applies to Intel® MIC Architecture.

Syntax

#pragma omp target data [clause, clause, ...]

structured-block

Arguments

clause

Can be zero or more of the following clauses:

Description

The target data construct defines a mapping from data on the host to data on the device. The mapping is defined by one or more map clauses. The map-type may be any of the following:

The following example demonstrates how to use this pragma to map to the values of a, b, and c to the device, perform some computation, and then assign values to e and f. At the end of the target data structured block, the values of e and f are copied back to the host.

Example

#pragma omp target data map(to:a,b,c) map(from:e,f) {
  #pragma omp target { e = f(a,b,c); }
  #pragma omp target { f = g(a,b,c); }
}