Task Specific Data within a **forall**

Within a forall

forall i in range do
    var aRowI = a[i, ..]; // copy to a loop local variable

    // work solely on row i during the loop

    a[i, ..] = aRowI; // copy backl

are there any guidelines or experience on whether or not to have a copy of (large memory footprint) variables defined outside loop?

Hi Damian —

There aren't general guidelines here since the benefit or downside of this can depend highly on the characteristics of the system you're running on, the computational intensity of the work on row i, etc. I'm not aware of that we've done any performance studies of codes that use this pattern.


Thanks for the quick reply. Something else for me to investigate when I have some spare time.