unified mem and cudaDeviceSynchronize() issue

when using cudaDeviceSynchronize() within for loop, for some reason my output read inf at output after 2 loop. The 1st loop is always correct.

memcpy host input to gpu here.
for(m=0=0;m<2000;m+=100){

reduction find peak
cudaDeviceSynchronize()

}

nvm it was my error