Moving Data from One Variable to Another

This topic only applies to Intel® Many Integrated Core Architecture (Intel® MIC Architecture).

This topic discusses using the into modifier with the offload set of pragmas

The into modifier enables you to transfer data from a variable on the CPU to another on the coprocessor, and the reverse, from a variable on the coprocessor to another on the CPU. Only one item is allowed in the variable-ref list when using the into modifier. Thus a one to one correspondence is established between a single source and destination.

When you use into with the in clause, data is copied from the CPU object to the coprocessor object. The alloc_if, free_if, and alloc modifiers apply to the into expression.

When you use into with the out clause, data is copied from the coprocessor object to the CPU object. The alloc_if, free_if, and alloc modifiers apply to the out expression.

The into modifier is not allowed with inout and nocopy clauses.

When you use the into modifier, the source expression generates a stream of elements to be copied into the memory ranges specified by the into expression. Overlap between the source and destination memory ranges leads to undefined behavior. No ordering can be assumed between transfers from different in and out clauses.

Example

int p[1000], p1[2000];
int rank1[1000], rank2[10][100];

// Partial copy
#pragma offload … in( p[0:500] : into (p1[500:500]) )

// Overlapping copy; result undefined
#pragma offload …    in( p[0:600]   : into (p1[0:600]) )    \
                     in( p[601:400] : into (p1[100:400]) ) 
// Shape change is not allowed
// Error!
#pragma offload …    out( rank1 : into(rank2) )
For more complete information about compiler optimizations, see our Optimization Notice.