Copy A to MIC and write result to B

Copy A to MIC and write result to B

I have arrays A and B (lets say they are big, 6GB each). I want to copy A to MIC, process it inplace and write the result to B. How do I do this?

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

To do this you would need to use the 'into' clause in your offload pragma. However, there are certain restrictions on the usage of this clause. You can find more at this compiler reference. 

I am copying a part of the compiler FAQs which could possibly help here: 

Q) The into modifier does not work correctly with offload or results in an error?

The into modifier enables you to transfer data from a variable on the host to another variable located on the coprocessor, and vice versa. When you use into with the in clause, data is copied from the CPU object to the coprocessor object. The alloc_iffree_if, and alloc modifiers apply to the into expression.

Similarly, when you use into with the out clause, data is copied from the coprocessor object to the CPU object. The alloc_iffree_if, and alloc modifiers apply to the out expression. However, there are certain conditions you need to fulfill for the into directive to work correctly with an offload.

  • The into modifier is not allowed with inout and nocopy clauses.
  • An overlap between the source and destination memory ranges leads to undefined behavior.
  •  Shape change is not allowed, e.g. transferring from a 1D array to a 2D array.

More information can be found in the compiler reference at:
Key Features > Intel® Many Integrated Core Architecture (Intel® MIC Architecture) > Programming for Intel® MIC Architecture > Offload using a pragma > Moving Data from One Variable to Another.

Thanks Sumedh.

Leave a Comment

Please sign in to add a comment. Not a member? Join today