In this day ,When i try to use to CUDA language to add 0.02 to same number in the same time,I got the wrong answer,but when add 1 ,It will be get the right answer,Who can tell why?
my code:
[codebox] int i;
__shared__ float ddaa[NUM];
i=blockDim.x*blockIdx.x+threadIdx.x;
ddaa[i]=dda[i];
if(i<NUM) ddaa[i]=ddaa[i]+0.2;
//if(i<=NUM) ddaa[i]=0;
dda[i]=ddaa[i];[/codebox]
NUM == 1024
s1<<<2,512>>>(da);
I got the answer like :
6.1999998
7.1999998
.
.
16.2000008
.
.
.
102.1999969
.
.
.