Intel® Fortran Compiler 16.0 User and Reference Guide

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 directives

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

In the following example:

INTEGER :: P (1000), P1 (2000)
INTEGER :: RANK1 (1000), RANK2 (10, 100)

!          Partial copy
!DIR$ OFLOAD … IN ( P (1:500) : INTO ( P1 (501:1000) ) ) …

!          Overlapping copy; result undefined
!DUR$ OFFLOAD … IN ( P (1:600) : INTO ( P1 (1:600) ) ) … &
&               IN ( P (601:1000) : INTO ( P1 (100:499) ) ) …

!          Rank change is not allowed – error
!DIR $ OFFLOAD … OUT ( RANK1, OUT (RANK2) ) …

See Also