Forum Discussion

WWP00's avatar
WWP00
Icon for New Contributor rankNew Contributor
7 years ago

What is the most effective way to copy subsets of arrays between local and global memory?

For example, suppose we have a local memory array:

float local[10];

And a much larger, global memory array. Would we copy like:

int memStart = 50;

for (int i = 0; i < 10; ++i)

local[i] = globalMem[memStart + i];

Or should we use #pragma unroll for this copy, to avoid making the loop take one clock cycle per copy? Or is there some other recommended way to move array data between local and global memory?

3 Replies