Intel® Fortran Compiler 16.0 User and Reference Guide
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.
In the following example:
The "Partial copy" case copies the first 500 elements of P to the last 500 elements of P1.
The "Overlapping copy" case copies the first 600 elements of P into P1 but then tries to copy the last 400 elements of P into P1(100) and beyond, but P1 (100) was initialized by the previous IN clause
The "rank change" is an error because rank 2 data on the coprocessor is being copied back to rank 1 data on the CPU, even though the sizes are the same.
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) ) …