I have a shared memory variable in the Kernel named “backgNoise”, and the value of backgNoise can only be gotten in 1st thread. How can I promise other threads use it after it update the value?
dim3 block_dimension(10, 10);
thread_dimension = 60;
kernel<<<block_dimension, thread_dimension >>>(dataArray_device, valueTauCMM_device);
kernel{
shared float backgNoise;
if(threadIdx.x == 0) {
backgNoise = a;
}
b[threadIdx.x] = b[threadIdx.x] - backgNoise;
}
I’ve tried syncthreads. In these two ways:
1.
if(threadIdx.x == 0) {
backgNoise = a;
__syncthreads();
}
if(threadIdx.x == 0) {
backgNoise = a;
}
__syncthreads();
But they just work when block has less than 32 threads. When I use more than 32 threads,it just fail.