Search code examples
intelxeon-phi

Meaning of nocopy clause in Xeon Phi Programming


I'am new to Xeon Phi Programming and i'am currently trying to learn explicit offload programming ... I have been going through certain tutorials provided by intel but i couldn't properly understand the meaning of nocopy clause if any one know about it please try to explain by giving an example of its usage in different scenarios and it will be great help if you can introduce me to any interactive tutorials on the web.


Solution

  • For a default #pragma offload, these five things happen:

    1. allocate space on Xeon Phi
    2. move data to Xeon Phi
    3. do math
    4. move data from Xeon Phi
    5. free allocated buffers

    the nocopy clause tells the pragma to skip steps 2 and steps 4.

    An use case for this is when you are doing an asynchronous offload.

    Moving data across PCIe of 1st gen Xeon Phi or fabric for 2nd gen Xeon Phi has latency, especially for large array. It would be more efficient if you could do something else on your host machine while do you do the offload transfer.

    Asynchronous offload is when you use a combination of #pragma offload_transfer, to only move data without calculation, and #pragma offload, to do your calculations, and of course, do something between the two pragmas on your host machine.

    You specify the nocopy clause for #pragma offload because you already transferred the data to the Xeon Phi with the first #pragma offload_transfer.