add cudaDeviceSynchronize inside if(unified)