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?
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_if, free_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_if, free_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.
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.