Problem accessing data accurately from shared memory in kernel

Hi I have a weired problem accessing data accurately from shared memory on kernel.

Basically I have a data array(A[500]) in shared memory, if I copy them to another array B[500] and move it back to host side for print, it looks exactly what I expect to see.

shared char A[500];

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

But if I further randomly pick up some data from the array A[500] after the above copy like below

shared char A[500];

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


When I move B to the host side and print everything out, B[0]~B[499] are always correct, but the data after that(B[500]~B[503]) are partly correctly and partly just 0…So weired, Is that the problem of possible bank conflict? synchronize seems not that helpful to this problem. Any idea?


Bank conflicts never lead to wrong results, they only slow down execution.

Can you post a self contained example (kernel and host code calling it) that demonstrates your problem? There are numerous things that could have gone wrong here as shared memory is a per-block resource and you don’t write anything about your thread and block configuration. When you post the code, please enclose in in [code] [/code] tags for better readability.