I have a simple opencl code like that:
__kernel void cache(
__global float* data,
__local float* sharedData)
{
int globalId=get_global_id(0);
int localId=get_local_id(0);
// Cache data to local memory
sharedData[localId]=data[globalId];
}
There are two input memory, one is global one is local.
For example, the global size I applied is {10000}, and the local size is {10}
So this "int globalId=get_global_id(0);" will get a number between 0~9999 right? "int localId=get_local_id(0);" will get a number like: "0~9"
Then how does this "sharedData[localId]=data[globalId];" Copy the data from global to local? Will we have 10000* 10's situations? like:
sharedData[0]=data[0];
sharedData[0]=data[1];
sharedData[0]=data[2];
...
sharedData[1]=data[0];
sharedData[1]=data[1];
...
So, what's going on about sharedData[localId]=data[globalId];
Thanks!